Washington DC Endpoint Management User Group

 View Only

Missing Escape Charactor in Command Script

  • 1.  Missing Escape Charactor in Command Script

    Posted Jun 12, 2012 06:15 PM

    I am trying to run the following batch in a NS task but I am missing some escape charctor to allow the FOR to run correctly. Any idea on what the correct way to write it is in NS? I am moving DS 6.9 task over to NS 7.1 and keep running into issues like this...

     

    @Echo OFF
    schtasks /Run /TN "NS.Delta Resource Membership Update.{67431011-a4c3-457c-b4ff-fa7ce7812260}"

    :Check
    for /f "Tokens=*" %%a in ('schtasks /Query /TN "NS.Delta Resource Membership Update.{67431011-a4c3-457c-b4ff-fa7ce7812260}" ^|Find /C "Running"') do SET IsRunning=%%a

     Echo Running: %IsRunning%

    If %IsRunning% GTR 0 (
        ECHO Still Running
        GoTo Check
    )