|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Here's the script that I'm testing. setlocal enabledelayedexpansion for /f "tokens=1,2,3 delims=/" %%i in ("%date:~4%") do (set yfm=%%i) goto :eof Now, here's the output. Notice that the variable yfm isn't getting updated. C:\Working>test.bat C:\Working>setlocal enabledelayedexpansion C:\Working>for /F "tokens=1,2,3 delims=/" %i in ("03/07/2007") do (set yfm=%i ) C:\Working>(set yfm=03 ) C:\Working>goto :eof C:\Working>echo %yfm% 03/07/2007 C:\Working> Is there any reason why !yfm! wouldn't be updating? It should be "03" when echo'd. JJ On Mar 7, 10:27 am, doubleJ <doub***@discussions.microsoft.com> wrote:
Show quote > Hello... That's peculiar, 'cause it works as expected for me (XP SP2).> Here's the script that I'm testing. > > setlocal enabledelayedexpansion > for /f "tokens=1,2,3 delims=/" %%i in ("%date:~4%") do (set yfm=%%i) > goto :eof > > Now, here's the output. Notice that the variable yfm isn't getting updated. > > C:\Working>test.bat > C:\Working>setlocal enabledelayedexpansion > C:\Working>for /F "tokens=1,2,3 delims=/" %i in ("03/07/2007") do (set > yfm=%i ) > C:\Working>(set yfm=03 ) > C:\Working>goto :eof > C:\Working>echo %yfm% > 03/07/2007 > C:\Working> > > Is there any reason why !yfm! wouldn't be updating? It should be "03" when > echo'd. > JJ Tom Lavedas =========== http://members.cox.net/tglbatch/wsh I know it's peculiar, that's why I posted.
Hehehe... I'm using xp sp2, as well. JJ Show quote "Tom Lavedas" wrote: > That's peculiar, 'cause it works as expected for me (XP SP2). On Mar 9, 1:27 am, doubleJ <doub***@discussions.microsoft.com> wrote:
> I know it's peculiar, that's why I posted. Okay, so my guess is that your posted example is not the exact> Hehehe... > I'm using xp sp2, as well. > JJ > > "Tom Lavedas" wrote: > > That's peculiar, 'cause it works as expected for me (XP SP2). condition that is creating the error. Rather, it is an extract from a larger procedure such that the real problem is created by some other aspect of that larger procedure. I say that for two reasons: first the setlocal statement is not applicable in the example you posted and the second is that the output you posted has an ECHO statement not shown in the example. I think you're going to need to post a complete example that exactly creates your problem. Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ |
|||||||||||||||||||||||