I am trying to run something like this: set drivepath = %CD%
set folder = tester
IF NOT EXIST %drivePath%\%folder% md %drivePath%\%folder%I can make it work when I place tester into the if statement instead of the folder variable.
what is wrong?
Thanks
Trevor
"what is wrong?" The spaces in the SETs.
=====================================
Helping others achieve escape felicityM2
spaces don't make a difference. I say again, "I can make it work when I place tester into the if statement instead of the folder variable." this is not changing anything in the code but the variable %folder% is deleted and the tester is in its place.
making that %folder% variable in that path name just doesn't seem to take.
any ideas?
Thanks for the help,
Trevor
foremore: any ideas?
Mechanix2Go: The spaces in the SETs.
this still doesn't work set drivepath=%CD%
set folder=tester
IF NOT EXIST %drivePath%\%folder% md %drivePath%\%folder%(without the spaces for the sets)
what else?
set drivepath=%CD%
set folder=tester
IF NOT EXIST "%drivePath%\%folder%" md "%drivePath%\%folder%"
=====================================
Helping others achieve escape felicityM2
yeah, in this age of insanity, we always need quotes :(
other thing, post your full code? is it inside a block? then you have the delayedexpansion issue going on...
another consideration is why worry? just attempt create the dir and ignore errors? that's what i usually do: md fff 2>nul || goto :testnext
but i do understand if you need finer tuning, like if a file already exists by that name etc.
Quotes ... always the same problems return ... Note that some commands do work nicely though (MS is not consistent here):
D:\Temp>mkdir This is a test
D:\Temp>cd This is a test
The system cannot find the path specified.D:\Temp>mkdir "This is a test"
D:\Temp>cd This is a test
D:\Temp\This is a test>
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |