Jump to content

How2 run BAT files in background


Recommended Posts

I wrote some batch files, but I want them to run in the background (without dos-prompt window, even not minimized). The user doesn't need to inerfere with the script because it always does the same things. But its useless windows poping up in the taskbar are annoying and cause slow computers to scratch.

thanks.

Link to comment
Share on other sites


This is the batch file I want to run in the bkgrd.

The batch file should be launched by a right-clic menu (that I add myself with ContextEdit) on selected files in Explorer.

The goal is to launch only one instance of a script or program for the whole selection instead of one instance for each selected file.

All the paths are writen in a list, then the script read this list and perform accordingly.

The trick used is deleting a nul file, an operation that obviousely only one instance of the batch file can do (a file can be deleted only once). Then if the file already doesn't exist, it skips the script launch command...and only apend the path to the list.

Later, the script re-create the nul file and erase the list.

I did a similar script in VBS but it was disastrous on a slow computer. In BAT it works better albeit with some errors (some selected files are not added to the list).

And there are also these invasive taskbar tabs... that certainely waist the rarefied resources of the old computer.

x.nul is the nul file

tmp.txt is the list file

ess2.vbs is the script to be launched.

@echo off
if not exist C:\Progra~1\Bat&vbs\x.nul goto writelist
del C:\Progra~1\Bat&vbs\x.nul
cd..
cd \WINDOWS
C:\WINDOWS\WScript.exe "C:\Progra~1\Bat&vbs\ess2.vbs"
:writelist
echo %1 >> C:\Progra~1\Bat&vbs\tmp.txt
exit

Link to comment
Share on other sites

  • 2 weeks later...

kelsenellenelvian,

Thanks for the exe! It works! Thought I coudn't try it on the slow computer.

But I will need to know how you did because I will need to do a version for each vbs.

Also why 150 kb! Did you add your personal flash screen or something? :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...