Using SET to set an empty value to a variable works nicely in a Windows XP .CMD script. However, the same SET command behaves differently in the same CMD interpreter when used directly from command-line:
Trying to test it in a CMD.EXE command-line:
C:\>set Q= C:\>echo %Q% %Q% C:\>echo "%Q%" "%Q%" C:\>set Q=/Q C:\>echo %Q% /Q C:\>echo "%Q%" "/Q"
Trying to test it with a .CMD script like this:
set Q= echo %Q% echo "%Q%" set Q=/Q echo %Q% echo "%Q%"
C:\>c.cmd C:\>set Q= C:\>echo ECHO is on. C:\>echo "" "" C:\>set Q=/Q C:\>echo /Q /Q C:\>echo "/Q" "/Q"
What am I missing?
Is that a nice joke from Redmond, or is there any sane explanation for this difference?
How am I supposed to test lines from a .CMD script when they behave differently when used in a command-line?
How do I properly set a variable to an empty string value in a CMD command-line and how do I reference that variable so that I get that empty string?