• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

cmd command

R

RedLars

Flightless Bird
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]

Flightless Bird
"RedLars" <liverpool1892@gmail.com> wrote in message
news:e925cb09-d525-4dcc-8a36-14cb289dda12@z10g2000yqb.googlegroups.com...
> 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.
 
Top