开发者

Windows batch file 'del' not working

开发者 https://www.devze.com 2023-01-05 02:27 出处:网络
I am trying to do the foll开发者_StackOverflowowing in a batch file on Windows 7: del \"./cfg/config.cfg\"

I am trying to do the foll开发者_StackOverflowowing in a batch file on Windows 7:

del "./cfg/config.cfg"
del "./cfg/server_blacklist.txt"

I tried these variations too:

del ./cfg/config.cfg
del ./cfg/server_blacklist.txt

del "cfg/config.cfg"
del "cfg/server_blacklist.txt"

del cfg/config.cfg
del cfg/server_blacklist.txt

Without using the "-characters the command prompt tells me the given parameter is not correct.

With using the "-characters, it's telling me that it can't find the path, even though it's there, including the files in it.

How can I fix this?


Use backslashes:

del ".\cfg\config.cfg"
...

del is a shell built-in command and those traditionally behave a little weird compared with the rest of the system. While the Windows API usually doesn't care what kind of slashes you use, cmd's built-in commands do care.

0

精彩评论

暂无评论...
验证码 换一张
取 消