Fusseldieb
Fusseldieb

Reputation: 1374

Run CMD command with file with spaces

When I try to acess a file with spaces and then give them arguments, it doesn't recognize the path. If I type following it works:

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

[This works]

If I try following, doesn't:

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

[Here it says 'C:/Path' doesn't is a valid file]

Neither this:

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

[Here it says that the syntax is incorrect]

How must the syntax be, in order to read that file with spaces and give them arguments?

EDIT: You can try this even if you haven't adb installed. You will se that it will always fail, even on a existing file

Upvotes: 2

Views: 1813

Answers (2)

Paul
Paul

Reputation: 2710

As explained here you can run cmd like one of this:

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

or

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

Upvotes: 1

AndiGeeky
AndiGeeky

Reputation: 11464

For using cmd command you need to use "Your File Name" ..

Here is an example..

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

Edited : You can use below command for path in cmd :

cd "Path With Spaces"

For more detail, Refer this link and accepted answer..!!

How to use spaces in CMD?

Hope It will help you.

Thanks..!!

Upvotes: 2

Related Questions