| | |
getting around spaces in windows command prompt commands
![]() |
•
•
Join Date: Jul 2005
Posts: 5
Reputation:
Solved Threads: 0
Hi,
I've not had to use the command prompt in Windows XP Pro too much so I'm not too familiar with how to deal with things such as spaces in the names of directories and files.
I'm looking to run an executable in a directory but the path contains several spaces in the folder names. i.e. c:\Program Files\Application Folder\Program Name\executable.exe.
How can I get around the problem with the spaces to be able to run the executable from the command prompt?
Thanks
slip
I've not had to use the command prompt in Windows XP Pro too much so I'm not too familiar with how to deal with things such as spaces in the names of directories and files.
I'm looking to run an executable in a directory but the path contains several spaces in the folder names. i.e. c:\Program Files\Application Folder\Program Name\executable.exe.
How can I get around the problem with the spaces to be able to run the executable from the command prompt?
Thanks
slip
•
•
Join Date: Feb 2005
Posts: 675
Reputation:
Solved Threads: 17
You can use spaces in CMD prompt. Here are a few commands that might help.
cd\ = get to the root of the drive. This is useful, as most cmd prompt start in c:\windows\system32
cd [file name] = accesses a folder in the current directory.
cd .. = goes back one directory level
dir = tells you the contents of that folder
/? = use this on the end of a command to see help on command extensions.
Example - Say I wanted to check contents of my desktop and documents, i would do as follows, (stuff after > is what I would put in, before is what is displayed)
c:\windows\system32>cd\
c:\>cd documents and settings
c:\documents and settings>cd david
c:\documents and settings\david>cd desktop
c:\documents and settings\david\desktop>dir
[shows contents]
c:\documents and settings\david\desktop>cd ..
c:\documents and settings\david>cd my documents
c:\documents and settings\david\my documents>dir
[shows contents]
You can also type full file locations such as
c:\>cd c:\documents and settings\david\desktop
c:\documents and settings\david\desktop>dir
In your example I would do the following
c:\windows\system32>cd\
c:\>cd c:\Program Files\Application Folder\Program Name
c:\Program Files\Application Folder\Program Name>executable.exe
That would run your program.
For a batch file that equates to;
cd\
cd c:\Program Files\Application Folder\Program Name
executable.exe
or
c:\Program Files\Application Folder\Program Name\executable.exe
Hope this is what you were after
cd\ = get to the root of the drive. This is useful, as most cmd prompt start in c:\windows\system32
cd [file name] = accesses a folder in the current directory.
cd .. = goes back one directory level
dir = tells you the contents of that folder
/? = use this on the end of a command to see help on command extensions.
Example - Say I wanted to check contents of my desktop and documents, i would do as follows, (stuff after > is what I would put in, before is what is displayed)
c:\windows\system32>cd\
c:\>cd documents and settings
c:\documents and settings>cd david
c:\documents and settings\david>cd desktop
c:\documents and settings\david\desktop>dir
[shows contents]
c:\documents and settings\david\desktop>cd ..
c:\documents and settings\david>cd my documents
c:\documents and settings\david\my documents>dir
[shows contents]
You can also type full file locations such as
c:\>cd c:\documents and settings\david\desktop
c:\documents and settings\david\desktop>dir
In your example I would do the following
c:\windows\system32>cd\
c:\>cd c:\Program Files\Application Folder\Program Name
c:\Program Files\Application Folder\Program Name>executable.exe
That would run your program.
For a batch file that equates to;
cd\
cd c:\Program Files\Application Folder\Program Name
executable.exe
or
c:\Program Files\Application Folder\Program Name\executable.exe
Hope this is what you were after
•
•
Join Date: Jul 2005
Posts: 5
Reputation:
Solved Threads: 0
Thanks very much for the info - a tutorial in itself
However, I probably asked for the wrong thing. What I am doing is using the "Run" utility located in Start/Run of the Windows XP Start Menu. I'm then entering in the path of the application - i.e. C:\Program Files\Application Folder\Program Name\executable.exe
I also need to include a " -p" at the end of the command and then again with " -g" (not exactly sure what these do - any info would be appreciated as I'm just following instructions). So it would be:
C:\Program Files\Application Folder\Program Name\executable -p
and then
C:\Program Files\Application Folder\Program Name\executable.exe -g
The error I'm getting when I try it with the above path name is:
"Windows cannot find 'C:/Program'. Make sure you typed the name correctly, and then try again."
So it obviously seems to trip up when it gets to the first <space> in the path name. I tried placing the application in the root of C: and it ran fine but I nee d to run if from the specified program directory (which includes spaces in the path name).
Any suggestions?
Thanks
Slip
However, I probably asked for the wrong thing. What I am doing is using the "Run" utility located in Start/Run of the Windows XP Start Menu. I'm then entering in the path of the application - i.e. C:\Program Files\Application Folder\Program Name\executable.exe
I also need to include a " -p" at the end of the command and then again with " -g" (not exactly sure what these do - any info would be appreciated as I'm just following instructions). So it would be:
C:\Program Files\Application Folder\Program Name\executable -p
and then
C:\Program Files\Application Folder\Program Name\executable.exe -g
The error I'm getting when I try it with the above path name is:
"Windows cannot find 'C:/Program'. Make sure you typed the name correctly, and then try again."
So it obviously seems to trip up when it gets to the first <space> in the path name. I tried placing the application in the root of C: and it ran fine but I nee d to run if from the specified program directory (which includes spaces in the path name).
Any suggestions?
Thanks
Slip
•
•
Join Date: May 2005
Posts: 514
Reputation:
Solved Threads: 19
very simple..
"c:\Program Files\Application Folder\Program Name\executable.exe"
Will Run fine.. Can even do this:
"c:\Program F*\Application Fo*\Program Na*\executable.exe"
"c:\Program Files\Application Folder\Program Name\executable.exe"
Will Run fine.. Can even do this:
"c:\Program F*\Application Fo*\Program Na*\executable.exe"
•
•
Join Date: May 2005
Posts: 514
Reputation:
Solved Threads: 19
You put them outside the " "
so its
"c:\space space space\program F*\thix.exe" -p
so its
"c:\space space space\program F*\thix.exe" -p
•
•
Join Date: Feb 2005
Posts: 675
Reputation:
Solved Threads: 17
In run type CMD. At the cmd prompt in the window, type the following, like the examples I gave earlier.
c:\windows\system32>cd\
c:\>cd c:\Program Files\Application Folder\Program Name
c:\Program Files\Application Folder\Program Name>executable.exe /?
This will give you the usage, and any file extensions like -p and what they do. Also any additional ones will be shown.
c:\windows\system32>cd\
c:\>cd c:\Program Files\Application Folder\Program Name
c:\Program Files\Application Folder\Program Name>executable.exe /?
This will give you the usage, and any file extensions like -p and what they do. Also any additional ones will be shown.
![]() |
Similar Threads
Other Threads in the Windows NT / 2000 / XP Forum
- Previous Thread: Text artifacts. Anyone familiar with this?
- Next Thread: Windows NT Display Properties
| Thread Tools | Search this Thread |
Tag cloud for Windows NT / 2000 / XP
.net 3.5 3daccelertion 64bit 2007 2010 activedirectory alaris android apache application arm auto automatically black blue book bsod bulletin canonical chinese chkdsk codeplex collaboration combofix computer crash deployments desktop desktops domain dotnetnuke downloads drive dual error explorer firefox folder fonts format freeze hardware install internet killprocess laptop linux load mac memory microsoft mobile monitor motionle1600 netbooks nvidia open opensource operatingsystems options osinstallationproblem partition product program proxy raid rds reformat remotedesktopconnection repair retail retrieve screen security server. slowperformance sp1 studios technology ubuntu uninstall update upgrade usb verizon virtual virus volume vpn vulnerability wab webos weecam windows windows7 windowsxp worm xp xpde





