CmdLine Request/"Bug"

Discussion in 'DCS Freeware' started by googlymoogly, Dec 1, 2006.

Thread Status:
Not open for further replies.
  1. googlymoogly

    googlymoogly Registered Member

    Joined:
    Dec 1, 2006
    Posts:
    1
    Or rather, unwanted behaviour.

    I wanted to use the most excellent tool CmdLine in a scheduled script that checks whether a certain process is running, and if not, then restart it. Due to several technical reasons, running them as services isn't advisable.

    So, anyway... this is my script:

    Code:
    dim apa
    set oShell = createobject("wscript.shell")
    mystr = "cmdline | find ""[COLOR="Red"][PATH_TO_EXECUTABLE][/COLOR]"" /i"
    set apa = oShell.exec("%comspec% /c """ & mystr & """")
    if apa.stdout.readall = "" then
    	DO STUFF
    else
    	DON'T DO STUFF
    end if
    
    cmdline always returns a line though, because, well... the piped find command is "running", see.

    You can even do

    Code:
    cmdline | find "asgojiesiosaegj" /i
    and it'll return

    find "asgojiesiosaegj" /i

    I suggest a switch for CmdLine that would ignore this type of thing, if possible.

    Thanks!

    [Edit]
    Actually, I found a solution by doing
    find "BLABLA" /i /c, and then checking for > 1.
    So this thread is kind of pointless I guess! I'll blame a long work day.
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.