A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » The Basics
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

bug in XP cmd shell



 
 
Thread Tools Display Modes
  #1  
Old December 23rd 08, 09:32 PM posted to microsoft.public.windowsxp.basics
Jim Michaels[_2_]
external usenet poster
 
Posts: 8
Default bug in XP cmd shell

in the cmd shell help (from cmd shell do set /?), it gives the example

set VAR=before
if "%VAR%" == "before" (
set VAR=after
if "%VAR%" == "after" @echo If you see this, it worked
)

the "if you see this, it worked" never shows.
I am using XP Pro SP3 32-bit on an HT processor that thinks it's a
dual-core.

Ads
  #2  
Old December 23rd 08, 09:37 PM posted to microsoft.public.windowsxp.basics
Jim Michaels[_2_]
external usenet poster
 
Posts: 8
Default bug in XP cmd shell

On Dec 23, 1:32*pm, Jim Michaels wrote:
in the cmd shell help (from cmd shell do set /?), it gives the example

* * set VAR=before
* * if "%VAR%" == "before" (
* * * * set VAR=after
* * * * if "%VAR%" == "after" @echo If you see this, it worked
* * )

the "if you see this, it worked" never shows.
I am using XP Pro SP3 32-bit on an HT processor that thinks it's a
dual-core.


oops. that example should be

set VAR=before
if "%VAR%" == "before" (
set VAR=after
if "!VAR!" == "after" @echo If you see this, it worked
)

the ! causes delayed expansion at execution.

apparently delayed expansion is not enabled by default...
  #3  
Old December 24th 08, 03:24 AM posted to microsoft.public.windowsxp.basics
a_nonymous
external usenet poster
 
Posts: 30
Default bug in XP cmd shell


"Jim Michaels" wrote:
in the cmd shell help (from cmd shell do set /?), it gives the example

set VAR=before
if "%VAR%" == "before" (
set VAR=after
if "%VAR%" == "after" @echo If you see this, it worked
)

the "if you see this, it worked" never shows.
I am using XP Pro SP3 32-bit on an HT processor that thinks it's a
dual-core.


"Jim Michaels" wrote:
oops. that example should be
set VAR=before
if "%VAR%" == "before" (
set VAR=after
if "!VAR!" == "after" @echo If you see this, it worked
)
the ! causes delayed expansion at execution.
apparently delayed expansion is not enabled by default...


Jim,
Did you enable delayed environment variable expansion via
CMD /vn


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 03:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.