getting around spaces in windows command prompt commands

Reply

Join Date: Jul 2005
Posts: 5
Reputation: slippy is an unknown quantity at this point 
Solved Threads: 0
slippy slippy is offline Offline
Newbie Poster

getting around spaces in windows command prompt commands

 
0
  #1
Jul 26th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 675
Reputation: MartyMcFly is an unknown quantity at this point 
Solved Threads: 17
MartyMcFly MartyMcFly is offline Offline
Practically a Master Poster

Re: getting around spaces in windows command prompt commands

 
0
  #2
Jul 26th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 5
Reputation: slippy is an unknown quantity at this point 
Solved Threads: 0
slippy slippy is offline Offline
Newbie Poster

Re: getting around spaces in windows command prompt commands

 
0
  #3
Jul 26th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 514
Reputation: techniner is an unknown quantity at this point 
Solved Threads: 19
techniner techniner is offline Offline
Posting Pro

Re: getting around spaces in windows command prompt commands

 
0
  #4
Jul 26th, 2005
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"
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 5
Reputation: slippy is an unknown quantity at this point 
Solved Threads: 0
slippy slippy is offline Offline
Newbie Poster

Re: getting around spaces in windows command prompt commands

 
0
  #5
Jul 26th, 2005
Yes the executable seems to run but I also need to perform the " -p" and " -g" commands on the file but then I get the error message as detailed in my previous post.

1) What do the " -p" and " -g" commands do?

2) How can I perform these on the exe in question without getting an error?

Thanks

slip
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 514
Reputation: techniner is an unknown quantity at this point 
Solved Threads: 19
techniner techniner is offline Offline
Posting Pro

Re: getting around spaces in windows command prompt commands

 
0
  #6
Jul 26th, 2005
You put them outside the " "

so its

"c:\space space space\program F*\thix.exe" -p
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 5
Reputation: slippy is an unknown quantity at this point 
Solved Threads: 0
slippy slippy is offline Offline
Newbie Poster

Re: getting around spaces in windows command prompt commands

 
0
  #7
Jul 26th, 2005
thanks for the info that did the job

by the way, I'm still curious as to what the "-p" and " -g" represent?

thanks for the help

slip
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 675
Reputation: MartyMcFly is an unknown quantity at this point 
Solved Threads: 17
MartyMcFly MartyMcFly is offline Offline
Practically a Master Poster

Re: getting around spaces in windows command prompt commands

 
0
  #8
Jul 27th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 5
Reputation: slippy is an unknown quantity at this point 
Solved Threads: 0
slippy slippy is offline Offline
Newbie Poster

Re: getting around spaces in windows command prompt commands

 
0
  #9
Jul 27th, 2005
Brilliant, that explained it all. Thanks very much for the help

slip
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Windows NT / 2000 / XP Forum
Thread Tools Search this Thread



Tag cloud for Windows NT / 2000 / XP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC