'和'不被视为内部或外部命令

时间:2013-01-27 22:31:35

标签: windows batch-file

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

@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 . . .

1 个答案:

答案 0 :(得分:4)

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

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

确保" (

之间有空格