.BAT file - What are all of the possible switches that will work outside a batch script?

7,043

Batch files themselves do not have any inherent switches.

They can accept parameters that can be passed into the batch file to be used as switches (or other things) as needed by the commands within the batch, but those are defined/implimented by the author of the batch script.

The switch you're speaking of (/B) is for the Exit command. If you want a list of switches for Exit (or practically any command prompt command), open a command prompt and type exit /?.

Share:
7,043

Related videos on Youtube

sludge705x
Author by

sludge705x

Updated on September 18, 2022

Comments

  • sludge705x
    sludge705x over 1 year

    Is there a resource that lists all of the possible switches that you can use on a bat file?

    I found this one that closes cmd.exe, which is very useful . . . "Startup.bat /B" . . . it took me hours to find it.

    /B . . . Specifies to exit the current batch script instead of CMD.EXE. If executed from outside a batch script, it will quit CMD.EXE . . . http://www.computerhope.com/exithlp.htm . . . DOES LOWER CASE b WORK? YES

    I put this bat file in my Startup folder, and use it as my Startup. The bat file makes it very easy to disable all Startups, just by re-naming it with the .txt extension.

    I wanted to see if there is a built-in switch like /S or /Q, where it would run the bat file silently, and you wouldn't see it . . . But maybe there isn't, on purpose, because it would be used for viruses.

  • sludge705x
    sludge705x over 7 years
    Links & replies help a lot TY! Question solved. I was trying to answer this question: "Scheduled task won't run .bat file" . . . My posts are on this page - first post is as . . . mb1280, Wednesday, August 03, 2016 9:04 PM . . . social.technet.microsoft.com/Forums/office/en-US/… I thought that I needed the /B switch in "Startup.bat /B" . . . in order to close the DOS window . . . I see that I don't! I've put the full story in the "Scheduled task won't run .bat file" page.