START Command-line command

E

ear

Hi. When I running the following commands from a .cmd batch file it
simply starts a Command Prompt window in directory "C:\Program Files
\Verizon Wireless\VZAccess Manager".

------ visp.cmd batch filie ---------------
setlocal
chdir "C:\Program Files\Verizon Wireless\VZAccess Manager\"
start /REALTIME /B "VZAccess Manager.exe"
endlocal
------------------------------

Is this because of spaces in "VZAccess Manager.exe" ? In an attempt to
generate short filename I ran the following command;
dir /x "c:\Program Files\Verizon Wireless\VZAccess Manager" *.exe
however it generated long filenames instead. How do I, or even should
I, turn on short filenames? or should I just convert all of
my .cmd/.bat files to Powershell scripts?
 
B

Big_Al

ear said this on 3/22/2009 12:52 PM:
Hi. When I running the following commands from a .cmd batch file it
simply starts a Command Prompt window in directory "C:\Program Files
\Verizon Wireless\VZAccess Manager".

------ visp.cmd batch filie ---------------
setlocal
chdir "C:\Program Files\Verizon Wireless\VZAccess Manager\"
start /REALTIME /B "VZAccess Manager.exe"
endlocal
------------------------------

Is this because of spaces in "VZAccess Manager.exe" ? In an attempt to
generate short filename I ran the following command;
dir /x "c:\Program Files\Verizon Wireless\VZAccess Manager" *.exe
however it generated long filenames instead. How do I, or even should
I, turn on short filenames? or should I just convert all of
my .cmd/.bat files to Powershell scripts?
How about
start ...... ".\VZAccess Manager.exe"
 
P

Pegasus [MVP]

ear said:
Hi. When I running the following commands from a .cmd batch file it
simply starts a Command Prompt window in directory "C:\Program Files
\Verizon Wireless\VZAccess Manager".

------ visp.cmd batch filie ---------------
setlocal
chdir "C:\Program Files\Verizon Wireless\VZAccess Manager\"
start /REALTIME /B "VZAccess Manager.exe"
endlocal
------------------------------

Is this because of spaces in "VZAccess Manager.exe" ? In an attempt to
generate short filename I ran the following command;
dir /x "c:\Program Files\Verizon Wireless\VZAccess Manager" *.exe
however it generated long filenames instead. How do I, or even should
I, turn on short filenames? or should I just convert all of
my .cmd/.bat files to Powershell scripts?

This happens because you omitted a parameter. Try the following version.
Note that there is no need for the "setlocal/endlocal" stuff.

@echo off
cd /d "C:\Program Files\Verizon Wireless\VZAccess Manager\"
start /REALTIME /B "Verizon Wireless" "VZAccess Manager.exe"
 
G

G. Morgan

ear said:
Hi. When I running the following commands from a .cmd batch file it
simply starts a Command Prompt window in directory "C:\Program Files
\Verizon Wireless\VZAccess Manager".

------ visp.cmd batch filie ---------------
setlocal
chdir "C:\Program Files\Verizon Wireless\VZAccess Manager\"
start /REALTIME /B "VZAccess Manager.exe"
endlocal
------------------------------

Is this because of spaces in "VZAccess Manager.exe" ? In an attempt to
generate short filename I ran the following command;
dir /x "c:\Program Files\Verizon Wireless\VZAccess Manager" *.exe
however it generated long filenames instead. How do I, or even should
I, turn on short filenames? or should I just convert all of
my .cmd/.bat files to Powershell scripts?

Try it with %20 instead of the spaces.

Example:

cd C:\Program Files\Verizon%20Wireless\VZAccess%20Manager\
 
P

Pegasus [MVP]

G. Morgan said:
Try it with %20 instead of the spaces.

Example:

cd C:\Program Files\Verizon%20Wireless\VZAccess%20Manager\

Using "%20" for spaces in URLs is fine. In batch files, "%20" means
something completely different. I recommend you try the command you
suggested.
 
G

G. Morgan

Pegasus said:
Using "%20" for spaces in URLs is fine. In batch files, "%20" means
something completely different. I recommend you try the command you
suggested.

Yup you're right. My bad. ;-)

Thanks.
 
T

Tim Meddick

Hi ear,
typing "dir /x" at the command prompt WILL generate short names as well
as the default long ones which, by the way, cannot be "turned off". the
command "cd" does not require quotes marks to surround a path as it ignores
spaces so:

CD C:\Program Files

....is quite permissible.

The point of including the extra "/d" parameter on the "ch" command, that is
"ch /d", is so that it will allow to change drives as well as directories
making sure that you will be in the target directory for certain. Thus:

CD /D C:\Program Files

....will get you there from any directory, any drive. The "start" command
will recognise long file names as long as they are in quotes. So, after
changing directories the next line should be:

START /REALTIME /B "VZAccess Manager.exe"

....just like you had, in fact. The "/b" parameter stops the command from
opening another command-window if it is a command-line (DOS-BOX) program,
but is redundant if it is starting a windows-based program. If this still
does not work, then I reckon your problem is going to be that you have
dropped a directory. Make sure the directory your program is in is the same
as the one stated in the "chdir" line in your cmd file. Then having spelled
the program correctly in the "start" line it cannot possibly fail.
 
P

Pegasus [MVP]

Tim Meddick said:
Hi ear,
typing "dir /x" at the command prompt WILL generate short names as well
as the default long ones which, by the way, cannot be "turned off". the
command "cd" does not require quotes marks to surround a path as it
ignores spaces so:

CD C:\Program Files

...is quite permissible.

The point of including the extra "/d" parameter on the "ch" command, that
is "ch /d", is so that it will allow to change drives as well as
directories making sure that you will be in the target directory for
certain. Thus:

CD /D C:\Program Files

...will get you there from any directory, any drive. The "start" command
will recognise long file names as long as they are in quotes. So, after
changing directories the next line should be:

START /REALTIME /B "VZAccess Manager.exe"

Nice and thorough explanation but unfortunately you omitted the same
parameter as the OP. Since the name of your executable includes a space, you
MUST add a further parameter like so:

START /REALTIME /B "Tim Meddick's Program" "VZAccess Manager.exe"

The name of the program can be a null string but it must be there. Try it
for yourself: Rename notepad.exe to "Note pad.exe", then run the command you
suggested.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top