Sunday, 17 September 2017

How do I escape spaces in command line in Windows without using quotation marks?


For example what is the alternative to this command without quotation marks:


CD "c:\Documents and Settings"

The full reason I don't want to use quotation marks is that this command DOES work:


   SVN add mypathname\*.*

but this command DOES NOT work :


   SVN add "mypathname\*.*"

The problem being when I change mypathname for a path with spaces in it I need to quote the whole thing. For example:


SVN add "c:\Documents and Settings\username\svn\*.*"

But when I try this I get the following error message:


svn: warning: 'c:\Documents and Settings\username\svn\*.*' not found

Answer



It almost all works for me, but have you perhaps tried line5.. escaping the space with a caret symbol (^)


1 C:\Documents and Settings\user>cd ..

2 C:\Documents and Settings>cd ..

3 C:\>cd Documents and Settings

4 C:\Documents and Settings>cd..

5 C:\>cd Documents^ and^ Settings

6 C:\Documents and Settings>cd..

7 C:\>cd C:\documents and settings

8 C:\Documents and Settings>cd..

9 C:\>

Or e.g. below where the caret really makes all the difference.


Looks from below like the caret symbol may be your answer, see line 3 below.


1 C:\>"c:\Documents and Settings\a.bat"
gaga

2 C:\>c:\Documents and Settings\a.bat
'c:\Documents' is not recognized as an internal or external command,
operable program or batch file.

3 C:\>c:\Documents^ and^ Settings\a.bat
gaga

C:\>

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...