Results 1 to 14 of 14
  1. #1
    5 Star Lounger
    Join Date
    May 2001
    Location
    Allen, Texas, USA
    Posts
    727
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Run bat file minimized

    I have a number of bat files that run throughout the day and are working great. Now I don't need/want to see them running and popping up in my face all day. How can I make them run either minimized or not on the screen at all?
    These bat files are run from the Windows Task Scheduler.

    Thanks!
    KZ

  2. #2
    jwoods
    Guest
    See post #7 in this thread...

    http://www.pcreview.co.uk/threads/ru...duler.2125918/

    I tested it on a Win7 64 bit Pro system, and it works.

  3. #3
    5 Star Lounger
    Join Date
    May 2001
    Location
    Allen, Texas, USA
    Posts
    727
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you for that reference. I'm still a little confused though.
    In the Scheduler I'm looking at the Edit action area. Is that where I'm to be? Right now the bat file is listed in the "Program/script" area as simply "C:\.....bat". Where is it that I'm to add the cmd / c start /min? It didn't work to put it in front of my bat nor in "Add arguments" section.

    Thanks!
    KZ

  4. #4
    jwoods
    Guest
    The Action will look like this...

    Run Batch File Minimized.jpg

    The "Add arguments" will look something like this...

    "C:\Users\Jim\Scripts\BatchLauncher.vbs" "C:\Users\Jim\Scripts\Test.bat"

  5. #5
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,175
    Thanks
    47
    Thanked 981 Times in 911 Posts
    You need to put it in the command and everything else in the arguments. Even better is to replace CMD with %comspec%. You probably also need a title represented by 2 quotes.
    Watch out for odd spaces, you have one between / and C.

    Program/script: %comspec%
    Add arguments: /c start "" /min "C:\.....bat"

    cheers, Paul

  6. #6
    5 Star Lounger
    Join Date
    May 2001
    Location
    Allen, Texas, USA
    Posts
    727
    Thanks
    1
    Thanked 0 Times in 0 Posts
    My bad...I see that you both mentioned #7 in that link.

    I've never used vbs before. Do I create a BatchLauncher.vbs file the same way I created a .bat file and just call it BatchLauncher.vbs?

  7. #7
    jwoods
    Guest
    Quote Originally Posted by kzkz View Post
    My bad...I see that you both mentioned #7 in that link.

    I've never used vbs before. Do I create a BatchLauncher.vbs file the same way I created a .bat file and just call it BatchLauncher.vbs?
    Correct.

  8. #8
    5 Star Lounger
    Join Date
    May 2001
    Location
    Allen, Texas, USA
    Posts
    727
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Nothing seems to happen. I put vbscript.exe in the Program/script area of the scheduler and in the Add arguments area I put "C:\xcopy backups\Batch files\Scripts/BatchLauncher.vbs" "C:\xcopy backups\Batch files\Copy_I.bat" and I also changed the 0 to 7 in the vbs file to have it visible but just minimized.

  9. #9
    jwoods
    Guest
    Quote Originally Posted by kzkz View Post
    Nothing seems to happen. I put vbscript.exe in the Program/script area of the scheduler and in the Add arguments area I put "C:\xcopy backups\Batch files\Scripts/BatchLauncher.vbs" "C:\xcopy backups\Batch files\Copy_I.bat" and I also changed the 0 to 7 in the vbs file to have it visible but just minimized.
    It should be wscript.exe in the Action area (see above screen shot).

    If this is "exactly" how you typed it in, you need a \ before BatchLauncher.vbs

    I would do a simple "proof of concept"...

    Create a simple batch file...call it "test.bat" and have it create a text file of the directory contents on your Desktop.

    dir /p > C:\Users\[your user name]\Desktop\dircontents.txt
    Last edited by jwoods; 2015-04-09 at 17:12.

  10. #10
    5 Star Lounger
    Join Date
    May 2001
    Location
    Allen, Texas, USA
    Posts
    727
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ahh, that did the trick. Worked PERFECTLY. Thanks for working with me on this!

    KZ

  11. #11
    jwoods
    Guest
    Quote Originally Posted by kzkz View Post
    Ahh, that did the trick. Worked PERFECTLY. Thanks for working with me on this!

    KZ
    Cool beans...you're rockin' now.

  12. #12
    Bronze Lounger DrWho's Avatar
    Join Date
    Dec 2009
    Location
    Central Florida
    Posts
    1,501
    Thanks
    30
    Thanked 205 Times in 163 Posts
    Just for future readers looking for a simple way to run a home-made batch file....

    I almost never run a batch file directly, but from a shortcut, where I can right click the shortcut, click on "Properties" and set it to run in a normal window, Minimized (only seen as an entry in the task bar while it's running) or Maximized, (running full screen).

    I can also set the shortcut to run the batch file to 'run as Administrator'.

    Using a shortcut is a very good way to run any program.

    Cheers Mates!
    The Doctor
    Experience is truly the best teacher.

    Backup! Backup! Backup! GHOST Rocks!

  13. The Following User Says Thank You to DrWho For This Useful Post:

    RolandJS (2015-04-19)

  14. #13
    5 Star Lounger
    Join Date
    May 2001
    Location
    Allen, Texas, USA
    Posts
    727
    Thanks
    1
    Thanked 0 Times in 0 Posts
    That's a great idea. Wish I had known about before (this script works great though). Would there be a way to use a shortcut in conjunction with the Task Scheduler?

    KZ

  15. #14
    3 Star Lounger
    Join Date
    Sep 2010
    Location
    Yarra Glen, Victoria, Australia
    Posts
    213
    Thanks
    0
    Thanked 38 Times in 24 Posts
    If you want to run a batch file as a scheduled task, and don't want to see it running, another trick is to run it with a different user who is not logged on. Set up a user just for this purpose (call it "Subtask" or "Background" or something similar, with its own password), and set the scheduled task to be run by that user (Properties > General > Change user or group). On the same General tab, check "Run whether user is logged on or not" and don't logon as that user. When the task runs, because the user is not logged on, nothing will happen on the screen, but the task will run as expected, provided the user has access to whatever you want to do. The task will appear in Task Manager/Process Explorer when it is running, but that's about all you will see of it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •