OT: why can't I use "tasklist" in the Windows XP Cmd window?

Phil Davis revdev at pdslabs.net
Wed May 18 18:10:33 EDT 2011


Hi Graham,

Try the "qprocess" shell command. I struggled with a similar issue in '09 and 
discovered this. "tasklist" and "qprocess"  should cover most if not all 
versions of Windows. To kill a task, I believe "tskill" and "taskkill" are your 
choices for killing a process on Windows.

I did something like this to discover which command was supported by the OS:


function validKillCommand
    -- handle MacOS
    if the platform = "MacOS" then return "kill -9"

    -- handle any flavor of Windows
    set the hideConsoleWindows to true

    -- try various 'kill' commands starting with most common
    get shell("taskkill /?")
    if the result = empty then return "taskkill /F /T /PID"

    get shell("tskill /?")
    if the result = empty then return "tskill"

    return empty -- no 'kill' command was found
end validKillCommand


Best -
Phil


On 5/18/11 2:00 PM, Graham Samuel wrote:
> Since I can't use 'the OpenProcesses' in LC to see what non-LC programs are running in Windows, I thought I'd look for the equivalent command in the cmd.exe command set, hoping in the end to run it via 'shell' from my LC app. The Microsoft documentation explains a function called 'tasklist' which looks promising, but my CMD window keep saying the command is not recognised. Other commands like 'start' and 'ipconfig' work OK. Can anyone with Windows knowledge explain what I'm doing wrong?
>
> TIA
>
> Graham
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net





More information about the use-livecode mailing list