简体   繁体   English

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

[英]'and' is not recognized as an internal or external command

how to check the existence of directory or file names with spaces 如何检查带空格的目录或文件名是否存在

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

error: 错误:

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

Take out the other quotes, paths are surrounded by only 1 set of quotes ( "" ) 取出其他引号,路径只包含一组引号( ""

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

Make sure there's a space between " ( 确保" (之间有空格)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM