Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.



Windows 7: Use of free form file names in Command Prompt

10 Jul 2011   #1

Windows 7 64 bit Ultimate
 
 
Use of free form file names in Command Prompt

Can someone advise me how to specify files names that contains a space, e.g.

the name "this file" in Command Prompt.

I tried using " and ' to quote the file name, but none works

Thanks

My System SpecsSystem Spec
.

10 Jul 2011   #2

Windows 7 Pro x64 SP1
 
 

Quote   Quote: Originally Posted by ffrree View Post
Can someone advise me how to specify files names that contains a space, e.g.

the name "this file" in Command Prompt.

I tried using " and ' to quote the file name, but none works

Thanks
Welcome ffrree, long file names with embedded spaces require a full set of quotes
starting and ending with no spaces at the front or end.

cmd "xxx readme.exe"
if this was an executable.

or
c:\> copy "file1 stuff.doc" "rrr is a file name.doc"

will work
notice the starting and ending quotes.

Rich
My System SpecsSystem Spec
10 Jul 2011   #3

MS Windows 7 Ultimate SP1 64-bit
 
 

ffrree,

Actually, in win 7 we do have a couple of changes.

As an example, go to a cmd prompt and type help cd

Here is part of what your will see:

If Command Extensions are enabled CHDIR changes as follows:

The current directory string is converted to use the same case as
the on disk names. So CD C:\TEMP would actually set the current
directory to C:\Temp if that is the case on disk.

CHDIR command does not treat spaces as delimiters, so it is possible to
CD into a subdirectory name that contains a space without surrounding
the name with quotes. For example:

cd \winnt\profiles\username\programs\start menu

is the same as:

cd "\winnt\profiles\username\programs\start menu"

which is what you would have to type if extensions were disabled.

Try it out by doing a
cd \program files

===============================

now what is the specific example which is giving you problems?
My System SpecsSystem Spec
.


10 Jul 2011   #4

Windows 7 Ultimate (x64)
 
 

There are some differences depending on which command line interpreter you are using. You can check the way your system behave by using the Tab key to fill in the rest of the file name (i.e. change your working directory to C:\ and type P then press the Tab key, or type D and press the tab key: the system will type the rest of the file (or folder) name automatically provided the name is unique). Do it once and you will know for sure.

On my PC I actively use two different prompts - the Windows command prompt and also the bash shell (powered by Cygwin). As you can see from the screnshot, the two handle spaces in the file names rather
differently.


Attached Images
 
My System SpecsSystem Spec
Reply

 Use of free form file names in Command Prompt





Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 12:15 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33