|
Answer» Hi All,
Can anyone shed any light why the follwoing line would work on machine but not on another:
for /f "tokens=2 delims=: " %%i in ('dir .') do set _OS_BUILDNUMBER=%%i
I get this error while execuing this from a file containing only this line:
C:\Users\User1>temp.cmd
C:\Users\User1>for /F "tokens=2 delims=: " %i in ('dir') do set _OS_BUILDNUMBER=%i 'dir' is not recognized as an internal or external command, operable program or batch file.
But it works FINE in another machine with same OS version.
Thanks. Any help is aprreciated.
PS.
This is just an example. Practical applicability of the line is not expressed here.
I see you posted this on MSDN scripting forums 20 hours ago... I guess we should be flattered... you even MISSPELLED "APPRECIATED" identically... You haven't said what OS and service pack version you are USING on each machine. I wonder if %comspec% is altered on the machine where dir does not work, if command extensions are enabled, and if cmd.exe has been damaged. Is one of the OSs Server 2003? Do other internal commands fail in a similar way?
Great! ComSpec was INDEED the issue. It's fixed now. Thanks.
Yay! CH 1 MSDN 0
|