cmd command

R

RedLars

Opening a console window (click start->run and type "cmd") and typing
the following starts my application
DefineVariables.bat&&start /D%_HOME_APP% AMain.exe -ip 127.0.0.1

I would like to add this set of operations to a shortcut with a nice
looking icon so I tried modifying it slightly and insert the below
into a shortcut but it does not work.
%windir%system32\cmd.exe /K C:\dev\DefineVariables.bat&&start /D
%_HOME_APP% AMain.exe -ip 127.0.0.1

but then I get "Windows cannot find 'AMain.exe'. Make sure you typed
the name correctly, and then try again. To search for a file..."

Have tried using different parameters but it has not made any
difference.

Inside DefineVariables.bat _HOME_APP is defined like this
set _HOME_APP="%PROGRAMFILES%\Abb version2\bin"

Any ideas why this does not work?
 
P

Pegasus [MVP]

RedLars said:
Opening a console window (click start->run and type "cmd") and typing
the following starts my application
DefineVariables.bat&&start /D%_HOME_APP% AMain.exe -ip 127.0.0.1

I would like to add this set of operations to a shortcut with a nice
looking icon so I tried modifying it slightly and insert the below
into a shortcut but it does not work.
%windir%system32\cmd.exe /K C:\dev\DefineVariables.bat&&start /D
%_HOME_APP% AMain.exe -ip 127.0.0.1

but then I get "Windows cannot find 'AMain.exe'. Make sure you typed
the name correctly, and then try again. To search for a file..."

Have tried using different parameters but it has not made any
difference.

Inside DefineVariables.bat _HOME_APP is defined like this
set _HOME_APP="%PROGRAMFILES%\Abb version2\bin"

Any ideas why this does not work?

You have too many extras in your command. Try this instead:

C:\dev\DefineVariables.bat & "%_HOME_APP%\AMain.exe" -ip 127.0.0.1

Note also:
- The single "&" operator. If you double it then the command that follows it
will only run if your batch file returns an %ErrorLevel% of 0.
- Double quotes inside a path should be avoided. You should therefore change
set _HOME_APP="%PROGRAMFILES%\Abb version2\bin"
to
set _HOME_APP=%PROGRAMFILES%\Abb version2\bin
so that you can surround the whole lot with double quotes.
 

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