Page 1 of 1

Get Shell Silently

Posted: Tue Dec 08, 2020 3:57 am
by 5imon
I'm currently trying to perform a get shell() and I'm having random successes in cases where it should just work.

Here's an example where it just works:

Code: Select all

get shell ("dir")
answer it
Works a treat.

The following more complex example also works without a hitch:

Code: Select all

get shell("cd C:/Users/5imon/AppData/Local/HaptUX/ExManCmdWin/ & dir")
answer it
But this won't work:

Code: Select all

get shell("C:/Users/5imon/AppData/Local/HaptUX/ExManCmdWin/ExManCmd /list all" )
... throws and error that it "is not recognized as an internal or external command".

However, with a little jiggery it does:

Code: Select all

get shell("cd C:/Users/5imon/AppData/Local/HaptUX/ExManCmdWin/ & ExManCmd /list " & quote & "all" & quote)
answer it
I don't mind the jiggery too much, but what I'd like to avoid is having the Windows 10 command prompt appearing on screen with a flashing prompt for the entire duration of time it takes for the shell to complete (~1-2 seconds).

Is there some way to run shell in silent mode? Maybe this is a bug in 9.6.2 rc 1? Could it be a new security feature in the latest Windows 10 update that dictates the user see any commands being run in the prompt that they did not personally type in?

Anyone?

Re: Get Shell Silently

Posted: Tue Dec 08, 2020 7:52 am
by FourthWorld
hideconsolewindows is what you're looking for:

https://livecode.com/resources/api/#liv ... olewindows

Re: Get Shell Silently

Posted: Tue Dec 08, 2020 3:25 pm
by 5imon
That worked perfectly, thanks Richard.