Using Shell Command To Open App In Windows

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
johnmiller1950
Posts: 101
Joined: Mon Apr 30, 2007 3:33 pm
Location: Dalton, Ohio

Using Shell Command To Open App In Windows

Post by johnmiller1950 » Tue Jan 18, 2011 4:50 am

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

doc
Posts: 148
Joined: Fri Jun 09, 2006 4:30 pm
Location: Oklahoma, USA

Re: Using Shell Command To Open App In Windows

Post by doc » Tue Jan 18, 2011 6:48 am

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:

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
Hope that helps,
-Doc-

johnmiller1950
Posts: 101
Joined: Mon Apr 30, 2007 3:33 pm
Location: Dalton, Ohio

Re: Using Shell Command To Open App In Windows

Post by johnmiller1950 » Tue Jan 18, 2011 12:27 pm

Doc,

That solved my problem. Thanks!

John

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Re: Using Shell Command To Open App In Windows

Post by alemrantareq » Wed Jan 19, 2011 4:36 am

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

demossj
Posts: 1
Joined: Thu Jun 06, 2013 12:37 am

Re: Using Shell Command To Open App In Windows

Post by demossj » Thu Jun 06, 2013 12:42 am

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

Klaus
Posts: 12204
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Using Shell Command To Open App In Windows

Post by Klaus » Thu Jun 06, 2013 10:06 am

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

bvlahos
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 77
Joined: Tue May 01, 2012 1:52 am

Re: Using Shell Command To Open App In Windows

Post by bvlahos » Tue Jun 24, 2014 9:37 pm

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?

Klaus
Posts: 12204
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Using Shell Command To Open App In Windows

Post by Klaus » Wed Jun 25, 2014 5:20 pm

Hi Bill,
I'm entering these with LC 6.6.2...
what exactly are you entering?


Best

Klaus

bvlahos
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 77
Joined: Tue May 01, 2012 1:52 am

Re: Using Shell Command To Open App In Windows

Post by bvlahos » Wed Jun 25, 2014 7:01 pm

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.

Ultravibe
Posts: 62
Joined: Sat Jan 17, 2015 12:06 pm

Re: Using Shell Command To Open App In Windows

Post by Ultravibe » Fri Oct 23, 2015 1:06 pm

Code: Select all

get shell (tCommand)
will this command locks execution of my App until launched program has finished?

Post Reply

Return to “Windows”