windows - escape drive name in batch file -


my batch file test.bat

c:\windows\system32\cmd.exe /c /d %i in (c:\programdata\puppetlabs\puppet\etc\ssl\*) rd /s /q "%i" 

when run above command manually command prompt, works , deletes contents c:\programdata\puppetlabs\puppet\etc\ssl.

now, same command when used in batch file , when run batch file, returns :

c:>test.bat

c:\>c:\windows\system32\cmd.exe /c /d \programdata\puppetlabs\puppet\etc\ssl\*) rd /s /q "i"  \programdata\puppetlabs\puppet\etc\ssl\*) unexpected @ time. 

above output miss out (c: batch file.

any idea ? in advance.

the problem different one!

note how %i missing in output when running command-line? , lot of different things next %i command-line line?

when using for-loop in batch, have escape single percent sign 1 loop parameter:

c:\windows\system32\cmd.exe /c /d %%i in (c:\programdata\puppetlabs\puppet\etc\ssl*) rd /s /q "%%i" 

should working :)


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -