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

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 .. …

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"

## All 8 Replies

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

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

Thanks very much for the info - a tutorial in itself :D

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

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"

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

You put them outside the " "

so its

"c:\space space space\program F*\thix.exe" -p

thanks for the info that did the job :D

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

thanks for the help

slip

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.

Brilliant, that explained it all. Thanks very much for the help :)

slip

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.