运行 带空格的文件的 CMD 命令

Run CMD command with file with spaces

当我尝试访问带有空格的文件然后给它们参数时,它无法识别路径。 如果我输入以下内容,它会起作用:

C:\Users\Valentino>cmd /C adb push "C:\Users\Valentino\Desktop\Test.dat" "/sdcard/"

[这个有效]

如果我尝试跟随,不会:

C:\Users\Valentino>cmd /C "C:/Path With Spaces/adb" push "C:\Users\Valentino\Desktop\Test.dat" "/sdcard/"

[这里说 'C:/Path' 不是有效文件]

这都不是:

C:\Users\Valentino>cmd /C "adb" push "C:\Users\Valentino\Desktop\Test.dat" "/sdcard/"

[这里说语法不正确]

语法必须如何才能读取带有空格的文件并给它们参数?

编辑:即使您没有安装 adb,也可以试试这个。你会发现它总是会失败,即使是在现有文件上

要使用 cmd 命令,您需要使用 "Your File Name" ..

这是一个例子..

keytool -exportcert -alias "your name" -keystore C:\Users\Desktop\your.keystore | C:\openssl-0.9.8k_X64\bin\openssl sha1 -binary | C:\openssl-0.9.8k_X64\bin\openssl base64

已编辑: 您可以在 cmd 中使用以下命令作为路径:

cd "Path With Spaces"

有关更多详细信息,请参阅此 link 并接受答案..!!

How to use spaces in CMD?

希望对你有所帮助

谢谢..!!

作为 explained here 你可以 运行 cmd 像这样:

cmd /C ""C:/Path With Spaces/adb" push C:\Users\Valentino\Desktop\Test.da /sdcard/"

cmd /C ""C:/Path With Spaces/adb" "push" "C:\Users\Valentino\Desktop\Test.da" "/sdcard/""