Using Shell Command To Open App In Windows
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 113
- Joined: Mon Apr 30, 2007 3:33 pm
- Location: Dalton, Ohio
Using Shell Command To Open App In Windows
Greetings All,
I am trying to open an app in Windows with the shell command. Here is my code:
get shell("c:\Program Files\myAppName")
When I run the code, a console window titled "C:WINDOWS\system32\cmd.exe" opens for a split second and then closes returning the result "1".
I suspect that the trouble lies with the SPACE between the word "Program" and "Files" in the path name. What I may be doing in this scenario is sending "c:\Program" with the parameter "Files\myAppName". I've tried putting the path name into variable XX and running "get shell(XX)", but I get the same results.
I eventually do want to send a parameter with this command, but I first have to figure out how to get the program to open. How does one format a pathname that uses a SPACE in a shell command? Can anyone help?
Please don't suggest using the "launch" command. This does work to open the program, but it doesn't allow me to send a parameter.
Thanks for your help,
John Miller
I am trying to open an app in Windows with the shell command. Here is my code:
get shell("c:\Program Files\myAppName")
When I run the code, a console window titled "C:WINDOWS\system32\cmd.exe" opens for a split second and then closes returning the result "1".
I suspect that the trouble lies with the SPACE between the word "Program" and "Files" in the path name. What I may be doing in this scenario is sending "c:\Program" with the parameter "Files\myAppName". I've tried putting the path name into variable XX and running "get shell(XX)", but I get the same results.
I eventually do want to send a parameter with this command, but I first have to figure out how to get the program to open. How does one format a pathname that uses a SPACE in a shell command? Can anyone help?
Please don't suggest using the "launch" command. This does work to open the program, but it doesn't allow me to send a parameter.
Thanks for your help,
John Miller
Re: Using Shell Command To Open App In Windows
Hello John,
If I'm understanding your problem correctly, I ran into something similar that someone else was having difficulty with...
This works well for me:
Hope that helps,
-Doc-
If I'm understanding your problem correctly, I ran into something similar that someone else was having difficulty with...
This works well for me:
Code: Select all
on mouseUp
-- must set the folder location to the same as target executable
set the defaultFolder to "C:\PathToMyApp\"
put "Myappname.exe" & " myargumentlist" into tCommand -- notice space before argument list
set the hideConsoleWindows to true
get shell (tCommand)
-- reset the default folder location back as it was if required
end mouseUp
-Doc-
-
- Posts: 113
- Joined: Mon Apr 30, 2007 3:33 pm
- Location: Dalton, Ohio
Re: Using Shell Command To Open App In Windows
Doc,
That solved my problem. Thanks!
John
That solved my problem. Thanks!
John
-
- Posts: 203
- Joined: Wed Jul 23, 2008 8:46 am
Re: Using Shell Command To Open App In Windows
Did you tried with this command? -
Code: Select all
on mouseUp
set the hideconsolewindows to true
get shell("C:\progra~1\yourAppName.exe")
end mouseUp
Re: Using Shell Command To Open App In Windows
I'm pretty sure you need to surround the path with quotes in the shell command.
Code: Select all
on mouseUp
set the hideconsolewindows to true
get shell("quote & C:\Program Files\yourAppName.exe & quote")
end mouseUp
Re: Using Shell Command To Open App In Windows
Hi friends,
there is also the function -> shortFilePath(filePath)
This will translate a long filepath WITH spaces into the old "DOS 8.1" format.
Very handy in situations like these
Best
Klaus
there is also the function -> shortFilePath(filePath)
This will translate a long filepath WITH spaces into the old "DOS 8.1" format.
Very handy in situations like these
Best
Klaus
Re: Using Shell Command To Open App In Windows
I'm entering these with LC 6.6.2 on Windows 7 in the IDE and I get errors on the shell command. Is there something else that needs to be set up?
Re: Using Shell Command To Open App In Windows
Hi Bill,
Best
Klaus
what exactly are you entering?I'm entering these with LC 6.6.2...
Best
Klaus
Re: Using Shell Command To Open App In Windows
The example I used was to get a directory listing from shell. What I really want to do is send “cmd=call=5555555555” to the mxie.lnk (shortcut to the application) in the path C:\ProgramData\Microsoft\Start Menu\Programs\Zultys MX\ .
If I navigate to C:\ProgramData\Microsoft\Start Menu\Programs\Zultys MX\ in the Windows cmd shell and then issue “mxie.lnk cmd=show” at the prompt the mxie application comes to the front. I will ultimately issue a call command as well which looks like this. "mxie.lnk cmd=call=5555555555" and will actually dial the number.
If I navigate to C:\ProgramData\Microsoft\Start Menu\Programs\Zultys MX\ in the Windows cmd shell and then issue “mxie.lnk cmd=show” at the prompt the mxie application comes to the front. I will ultimately issue a call command as well which looks like this. "mxie.lnk cmd=call=5555555555" and will actually dial the number.
Re: Using Shell Command To Open App In Windows
Code: Select all
get shell (tCommand)