|
| Delayedvariableexpansion |
| Newsgroup ::: microsoft.public.windowsxp.general |
| DelayedVariableExpansion | Options | Advertisers | ||||||||||||||||||||||||||||
Hello world, especially microsoft experts ... I'm trying for at least two weeks long to find a cure for the AMAZING :(((( delayed variable expansion feature. Almost all things do work in my batch script, except one thing - EXCLAMATION MARK. I have found one man's notes for bacth files and now I can echo exclamation mark when delayed variable expansion is ON. But I cannot echo the exclamation mark that is part of a variable: ************************************************* setlocal enabledelayedexpansion ECHO D:\^^!Backup - this will show D:\!Backup on the screen => OK ************************************************* setlocal enabledelayedexpansion SET BackupDirRoot=D:\^^!Backup ECHO %BackupDirRoot% - this will show D:\Backup on the screen => BAD BAD BAD ************************************************* The thing is that in the script I have to almost everytime disable and enable delayedvariableexpansion feature, not talking about the thing to be carefull where to use %variable% and where to use !variable! :(((((((((((((((( If someone knows how to get out of this MS mess, I would be very gratefull to him, but otherwise, people, you must understand that after almost a month of searching on the net how to solve this and being nearly at the same point, I cannot say that this feature is GOOD or better said: WELL DONE !!! :(( "Michael Knight" -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
|
|||||||||||||||||||||||||||||
| Re: DelayedVariableExpansion | Options | Advertisers | ||||||||||||||||||||||||||||
"Michael.Knight" <Michael.Knight@email.cz> wrote in message news:op.tavf1yo8sj1eug@czprg-radousj.eu.uis.unisys.com... > Hello world, especially microsoft experts ... > > I'm trying for at least two weeks long to find a cure for the AMAZING > :(((( delayed variable expansion feature. Almost all things do work in my > batch script, except one thing - EXCLAMATION MARK. > > I have found one man's notes for bacth files and now I can echo > exclamation mark when delayed variable expansion is ON. But I cannot echo > the exclamation mark that is part of a variable: > > ************************************************* > setlocal enabledelayedexpansion > > ECHO D:\^^!Backup > > - this will show D:\!Backup on the screen => OK > > ************************************************* > > setlocal enabledelayedexpansion > SET BackupDirRoot=D:\^^!Backup > ECHO %BackupDirRoot% > > - this will show D:\Backup on the screen => BAD BAD BAD > > ************************************************* > > The thing is that in the script I have to almost everytime disable and > enable delayedvariableexpansion feature, not talking about the thing to be > carefull where to use %variable% and where to use !variable! > :(((((((((((((((( > > If someone knows how to get out of this MS mess, I would be very gratefull > to him, but otherwise, people, you must understand that after almost a > month of searching on the net how to solve this and being nearly at the > same point, I cannot say that this feature is GOOD or better said: WELL > DONE !!! :(( > > "Michael Knight" > > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ I suspect you have stumbled over a limitation of batch files using delayed variable expansion. Try not to use it - AFAIK, you can always avoid it by calling subroutines. You might also repost your question in alt.msdos.batch.nt. This is where the batch file experts hang out. They would love the challenge! |
|
|||||||||||||||||||||||||||||
| Re: DelayedVariableExpansion | Options | Advertisers | ||||||||||||||||||||||||||||
Hi, When I do enable DelayedVariableExpansion feauture, the varibale is (in a FOR cycle or IF command) not updated and the system does not know !variable!, only %variable% :( OK, I will post this issue at the suggested phorum and if I will know more, I will keep you updated . Many thanks ! On Fri, 09 Jun 2006 11:37:56 +0200, Pegasus (MVP) <I.can@fly.com> wrote: > > "Michael.Knight" <Michael.Knight@email.cz> wrote in message > news:op.tavf1yo8sj1eug@czprg-radousj.eu.uis.unisys.com... >> Hello world, especially microsoft experts ... >> >> I'm trying for at least two weeks long to find a cure for the AMAZING >> :(((( delayed variable expansion feature. Almost all things do work in >> my >> batch script, except one thing - EXCLAMATION MARK. >> >> I have found one man's notes for bacth files and now I can echo >> exclamation mark when delayed variable expansion is ON. But I cannot >> echo >> the exclamation mark that is part of a variable: >> >> ************************************************* >> setlocal enabledelayedexpansion >> >> ECHO D:\^^!Backup >> >> - this will show D:\!Backup on the screen => OK >> >> ************************************************* >> >> setlocal enabledelayedexpansion >> SET BackupDirRoot=D:\^^!Backup >> ECHO %BackupDirRoot% >> >> - this will show D:\Backup on the screen => BAD BAD BAD >> >> ************************************************* >> >> The thing is that in the script I have to almost everytime disable and >> enable delayedvariableexpansion feature, not talking about the thing to >> be >> carefull where to use %variable% and where to use !variable! >> :(((((((((((((((( >> >> If someone knows how to get out of this MS mess, I would be very >> gratefull >> to him, but otherwise, people, you must understand that after almost a >> month of searching on the net how to solve this and being nearly at the >> same point, I cannot say that this feature is GOOD or better said: WELL >> DONE !!! :(( >> >> "Michael Knight" >> >> -- >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > > I suspect you have stumbled over a limitation of batch > files using delayed variable expansion. Try not to use it - > AFAIK, you can always avoid it by calling subroutines. > You might also repost your question in alt.msdos.batch.nt. > This is where the batch file experts hang out. They would > love the challenge! > > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
|
|||||||||||||||||||||||||||||
| Re: DelayedVariableExpansion | Options | Advertisers | ||||||||||||||||||||||||||||
I am quite aware of this. That's why I suggested subroutines - they are not affected by this issue because they do not require !variables!. "Michael.Knight" <Michael.Knight@email.cz> wrote in message news:op.tavijokpsj1eug@czprg-radousj.eu.uis.unisys.com... > Hi, > > When I do enable DelayedVariableExpansion feauture, the varibale is (in a > FOR cycle or IF command) not updated and the system does not know > !variable!, only %variable% :( > OK, I will post this issue at the suggested phorum and if I will know > more, I will keep you updated . > > Many thanks ! > > On Fri, 09 Jun 2006 11:37:56 +0200, Pegasus (MVP) <I.can@fly.com> wrote: > > > > "Michael.Knight" <Michael.Knight@email.cz> wrote in message > > news:op.tavf1yo8sj1eug@czprg-radousj.eu.uis.unisys.com... > >> Hello world, especially microsoft experts ... > >> > >> I'm trying for at least two weeks long to find a cure for the AMAZING > >> :(((( delayed variable expansion feature. Almost all things do work in > >> my > >> batch script, except one thing - EXCLAMATION MARK. > >> > >> I have found one man's notes for bacth files and now I can echo > >> exclamation mark when delayed variable expansion is ON. But I cannot > >> echo > >> the exclamation mark that is part of a variable: > >> > >> ************************************************* > >> setlocal enabledelayedexpansion > >> > >> ECHO D:\^^!Backup > >> > >> - this will show D:\!Backup on the screen => OK > >> > >> ************************************************* > >> > >> setlocal enabledelayedexpansion > >> SET BackupDirRoot=D:\^^!Backup > >> ECHO %BackupDirRoot% > >> > >> - this will show D:\Backup on the screen => BAD BAD BAD > >> > >> ************************************************* > >> > >> The thing is that in the script I have to almost everytime disable and > >> enable delayedvariableexpansion feature, not talking about the thing to > >> be > >> carefull where to use %variable% and where to use !variable! > >> :(((((((((((((((( > >> > >> If someone knows how to get out of this MS mess, I would be very > >> gratefull > >> to him, but otherwise, people, you must understand that after almost a > >> month of searching on the net how to solve this and being nearly at the > >> same point, I cannot say that this feature is GOOD or better said: WELL > >> DONE !!! :(( > >> > >> "Michael Knight" > >> > >> -- > >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > > > > I suspect you have stumbled over a limitation of batch > > files using delayed variable expansion. Try not to use it - > > AFAIK, you can always avoid it by calling subroutines. > > You might also repost your question in alt.msdos.batch.nt. > > This is where the batch file experts hang out. They would > > love the challenge! > > > > > > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
|
|||||||||||||||||||||||||||||
| Re: DelayedVariableExpansion | Options | Advertisers | ||||||||||||||||||||||||||||
I can't access alt.msdos.batch.nt server (is it a news server ?), even not via internet browser. Even alt.msdos.batch site ... Any help ? Has it gone ? Thanks for the feedback "Michael Knight" On Fri, 09 Jun 2006 16:29:30 +0200, Pegasus (MVP) <I.can@fly.com> wrote: > I am quite aware of this. That's why I suggested subroutines - > they are not affected by this issue because they do not > require !variables!. > > > "Michael.Knight" <Michael.Knight@email.cz> wrote in message > news:op.tavijokpsj1eug@czprg-radousj.eu.uis.unisys.com... >> Hi, >> >> When I do enable DelayedVariableExpansion feauture, the varibale is (in >> a >> FOR cycle or IF command) not updated and the system does not know >> !variable!, only %variable% :( >> OK, I will post this issue at the suggested phorum and if I will know >> more, I will keep you updated . >> >> Many thanks ! >> >> On Fri, 09 Jun 2006 11:37:56 +0200, Pegasus (MVP) <I.can@fly.com> wrote: >> > >> > "Michael.Knight" <Michael.Knight@email.cz> wrote in message >> > news:op.tavf1yo8sj1eug@czprg-radousj.eu.uis.unisys.com... >> >> Hello world, especially microsoft experts ... >> >> >> >> I'm trying for at least two weeks long to find a cure for the AMAZING >> >> :(((( delayed variable expansion feature. Almost all things do work >> in >> >> my >> >> batch script, except one thing - EXCLAMATION MARK. >> >> >> >> I have found one man's notes for bacth files and now I can echo >> >> exclamation mark when delayed variable expansion is ON. But I cannot >> >> echo >> >> the exclamation mark that is part of a variable: >> >> >> >> ************************************************* >> >> setlocal enabledelayedexpansion >> >> >> >> ECHO D:\^^!Backup >> >> >> >> - this will show D:\!Backup on the screen => OK >> >> >> >> ************************************************* >> >> >> >> setlocal enabledelayedexpansion >> >> SET BackupDirRoot=D:\^^!Backup >> >> ECHO %BackupDirRoot% >> >> >> >> - this will show D:\Backup on the screen => BAD BAD BAD >> >> >> >> ************************************************* >> >> >> >> The thing is that in the script I have to almost everytime disable >> and >> >> enable delayedvariableexpansion feature, not talking about the thing >> to >> >> be >> >> carefull where to use %variable% and where to use !variable! >> >> :(((((((((((((((( >> >> >> >> If someone knows how to get out of this MS mess, I would be very >> >> gratefull >> >> to him, but otherwise, people, you must understand that after almost >> a >> >> month of searching on the net how to solve this and being nearly at >> the >> >> same point, I cannot say that this feature is GOOD or better said: >> WELL >> >> DONE !!! :(( >> >> >> >> "Michael Knight" >> >> >> >> -- >> >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ >> > >> > I suspect you have stumbled over a limitation of batch >> > files using delayed variable expansion. Try not to use it - >> > AFAIK, you can always avoid it by calling subroutines. >> > You might also repost your question in alt.msdos.batch.nt. >> > This is where the batch file experts hang out. They would >> > love the challenge! >> > >> > >> >> -- >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
|
|||||||||||||||||||||||||||||
| Re: DelayedVariableExpansion | Options | Advertisers | ||||||||||||||||||||||||||||
The usual way is to create a newsgroup account in Outlook Express. You need to specify your IPS's news server - it is usually something like news.MyISP.com.cz. Ask your ISP if you cannot work it out. After specifying the news server, you can select any of around 55,000 newsgroups, e.g. alt.msdos.batch.nt. Remember that you can avoid delayed expansion issues, by using subroutines. The two examples below do exactly the same thing. Unfortunately the second example takes about 200 times longer to run . . . @echo off setlocal EnableDelayedExpansion set sum=0 for /L %%a in (1,1,100) do set /a sum=!sum! + %%a echo Sum=%sum% endlocal @echo off set sum=0 for /L %%a in (1,1,100) do call :Sub %%a echo Sum=%sum% goto :eof :Sub set /a sum=%sum% + %1 "Michael.Knight" <Michael.Knight@email.cz> wrote in message news:op.ta1a0rmbsj1eug@czprg-radousj.eu.uis.unisys.com... > I can't access alt.msdos.batch.nt server (is it a news server ?), even not > via internet browser. Even alt.msdos.batch site ... > Any help ? Has it gone ? > > Thanks for the feedback > > "Michael Knight" > > On Fri, 09 Jun 2006 16:29:30 +0200, Pegasus (MVP) <I.can@fly.com> wrote: > > > I am quite aware of this. That's why I suggested subroutines - > > they are not affected by this issue because they do not > > require !variables!. > > > > > > "Michael.Knight" <Michael.Knight@email.cz> wrote in message > > news:op.tavijokpsj1eug@czprg-radousj.eu.uis.unisys.com... > >> Hi, > >> > >> When I do enable DelayedVariableExpansion feauture, the varibale is (in > >> a > >> FOR cycle or IF command) not updated and the system does not know > >> !variable!, only %variable% :( > >> OK, I will post this issue at the suggested phorum and if I will know > >> more, I will keep you updated . > >> > >> Many thanks ! > >> > >> On Fri, 09 Jun 2006 11:37:56 +0200, Pegasus (MVP) <I.can@fly.com> wrote: > >> > > >> > "Michael.Knight" <Michael.Knight@email.cz> wrote in message > >> > news:op.tavf1yo8sj1eug@czprg-radousj.eu.uis.unisys.com... > >> >> Hello world, especially microsoft experts ... > >> >> > >> >> I'm trying for at least two weeks long to find a cure for the AMAZING > >> >> :(((( delayed variable expansion feature. Almost all things do work > >> in > >> >> my > >> >> batch script, except one thing - EXCLAMATION MARK. > >> >> > >> >> I have found one man's notes for bacth files and now I can echo > >> >> exclamation mark when delayed variable expansion is ON. But I cannot > >> >> echo > >> >> the exclamation mark that is part of a variable: > >> >> > >> >> ************************************************* > >> >> setlocal enabledelayedexpansion > >> >> > >> >> ECHO D:\^^!Backup > >> >> > >> >> - this will show D:\!Backup on the screen => OK > >> >> > >> >> ************************************************* > >> >> > >> >> setlocal enabledelayedexpansion > >> >> SET BackupDirRoot=D:\^^!Backup > >> >> ECHO %BackupDirRoot% > >> >> > >> >> - this will show D:\Backup on the screen => BAD BAD BAD > >> >> > >> >> ************************************************* > >> >> > >> >> The thing is that in the script I have to almost everytime disable > >> and > >> >> enable delayedvariableexpansion feature, not talking about the thing > >> to > >> >> be > >> >> carefull where to use %variable% and where to use !variable! > >> >> :(((((((((((((((( > >> >> > >> >> If someone knows how to get out of this MS mess, I would be very > >> >> gratefull > >> >> to him, but otherwise, people, you must understand that after almost > >> a > >> >> month of searching on the net how to solve this and being nearly at > >> the > >> >> same point, I cannot say that this feature is GOOD or better said: > >> WELL > >> >> DONE !!! :(( > >> >> > >> >> "Michael Knight" > >> >> > >> >> -- > >> >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > >> > > >> > I suspect you have stumbled over a limitation of batch > >> > files using delayed variable expansion. Try not to use it - > >> > AFAIK, you can always avoid it by calling subroutines. > >> > You might also repost your question in alt.msdos.batch.nt. > >> > This is where the batch file experts hang out. They would > >> > love the challenge! > >> > > >> > > >> > >> -- > >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > > > > > > > > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
|
|||||||||||||||||||||||||||||
| Comments | |||
|
|||
| Add Comments | |||
|
|||