locked
Running a .cmd file RRS feed

  • Question

  • Hey,
    i am trying to run a .cmd file as an application. The file does what it is suppose to but returns an error code 1 at the end of the TS. Is there anyway to silence this error?
    Tuesday, May 26, 2015 5:13 PM

Answers

  • The GOTO statement shouldn't really be needed.  When you ran the batch file from a command prompt what %errorlevel% does it return?

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


    • Proposed as answer by Dan_Vega Tuesday, May 26, 2015 7:06 PM
    • Marked as answer by NovaMatt Tuesday, May 26, 2015 7:11 PM
    • Edited by Ty Glander Tuesday, May 26, 2015 9:08 PM grammar
    Tuesday, May 26, 2015 6:40 PM

All replies

  • Error 1 is incorrect function. Might be interesting to look at the cmd file. Run it from a cmd prompt and then echo %errorlevel%.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Tuesday, May 26, 2015 5:33 PM
  • @Echo Off

    Rem Disable Sleep on lid Close
    powercfg -setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
    powercfg -setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0

    Rem Sets power button to Shut Down
    powercfg -setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 3
    powercfg -setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 3

    Rem Disable Sleep on ac and dc
    powercfg -setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 238c9fa8-0aad-41ed-83f4-97be242c8f20 29f6c1db-86da-48c5-9fdb-f2b67b1f44da 0

    GOTO EXIT

    Tuesday, May 26, 2015 6:00 PM
  • The GOTO statement shouldn't really be needed.  When you ran the batch file from a command prompt what %errorlevel% does it return?

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


    • Proposed as answer by Dan_Vega Tuesday, May 26, 2015 7:06 PM
    • Marked as answer by NovaMatt Tuesday, May 26, 2015 7:11 PM
    • Edited by Ty Glander Tuesday, May 26, 2015 9:08 PM grammar
    Tuesday, May 26, 2015 6:40 PM
  • I agree with Ty, just remove the "GOTO EXIT" or if you want you can just leave EXIT. You would only need the GOTO if you had different sections in your batch file and needed to jump to the :Exit section.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Tuesday, May 26, 2015 7:08 PM
  • Thanks Ty,
    Will re run and see what happens
    Tuesday, May 26, 2015 7:12 PM