1

如何检查是否存在带空格的目录或文件名

@echo off
if not exist "C:\"Documents and Settings"\box\putty\file"
( 
echo hello
)
pause

错误:

'and' is not recognized as an internal or external command,
operable program or batch file.
hello
Press any key to continue . . .
4

1 回答 1

4

取出其他引号,路径仅被一组引号包围(""

@echo off
if not exist "C:\Documents and Settings\box\putty\file" ( 
echo hello
)
pause

确保中间有空格" (

于 2013-01-27T22:32:29.070 回答