Jump to content

[release] Run your batchfiles invisibly


seapagan

Recommended Posts

Hey,

I knocked together a quick program a few days ago, and posting it here in case anyone else would find it useful.

What it basically does is to enable you to run any batchfile (without modification) but have nothing appear on the screen, ie no CMD window will be visible.

I use this for creating my silent application installs, it removes the need to use 'cmdow' or similar. Many silent installers run using batchfiles to install the app, add registry entries, copy extra files etc, and this usually means having a CMD window visible on the screen, or using cmdow to hide it (which still flashes briefly). Otherwise, if you use a batch compiler you run the risk that it wont work properly on other peoples machines.

Usage is simple :

Just replace the part of your silent (7z or rar) installer that normally calls <batchfile> with :

batchrunner <batchfile>

There is also one command line option - /s - which will hide any errors that may occur so that if you are using this from runonceex your installation wil not pause to wait for you to press ok. Eg:

batchrunner install.cmd /s

One final thing, the batchfile name is optional - if one is not specified it will try to run 'install.cmd'. It always looks for the specified batch in the same directory as it is located, so works ok for silent installers when the archive is extracted to a temp directory.

I have tried this with several of my own silent installers, from RunOnceEx & SVCPACK, and it works perfectly :)

The program will wait until the batch has completed before exiting, so works well from RunOnceEx.

Program is totally standalone, just copy the .exe file into the same folder as the rest of the files for your silent installer before you archive the lot up.

I would recommend not using the /s switch until you are 100% sure that your installer works - just so you can see any error messages. Likewise, make sure your batch file is working properly before using batchrunner! You will see no console window to aid troubleshooting.

Please let me know how it works for you, any errors, and any suggestions for improvements.

SP

BatchRunner.7z

Edited by seapagan
Link to comment
Share on other sites


Way to go :thumbup

This has the advantage not having to edit your bat files

(like you do with cmdow)

Can this also be used on COM files?

thnx for sharing....

Thanks :D

At the moment this cannot be used on com files, because I deliberately restricted it to only bat or cmd in the code (try it, it will tell you its not a batch file).

There is no reason why the code should not work for com files though (even exe files I guess). I'll take a look later and try. As long as the com (or console exe) requires no user input I dont see a problem with it working.

SP

Link to comment
Share on other sites

Update:

I have just completed a full reinstall of XP on one of my machines, using this tool in a few silent installers run from SVCPACK and RunOnceEx with no problems. It also works from cmdlines.txt :)

SP

Link to comment
Share on other sites

alternative to cmdow @ /HID

I do not want to discourage you from writing useful tools, but:

nircmd.exe is only 24 Kb and can do more.

but i will try it for this feature:

One final thing, the batchfile name is optional - if one is not specified it will try to run 'install.cmd'. It always looks for the specified batch in the same directory as it is located, so works ok for silent installers when the archive is extracted to a temp directory.

I have tried this with several of my own silent installers and it works perfectly :)

Edited by Bilou_Gateux
Link to comment
Share on other sites

alternative to cmdow @ /HID

I do not want to discourage you from writing useful tools, but:

nircmd.exe is only 24 Kb and can do more.

True, but if I bothered to run upx on it, it comes out at 21Kb :P

nircmd is a good tool, but I wanted something quick, simple and without a plethora of command lines. Only took me about 20mins to write so I didn't waste my life on it! :D

Maybe I'll rewrite it in asm, see how small I can get it ;)

Thanks for the feedback

SP

Link to comment
Share on other sites

Great...another util worth it's weight in...KB? LOL

Very useful, even if there are other options...it's nice to have one program do one thing and nothing more.

I have moved from bat/cmd installs to AutoIT specifically because of this issue...but now I might switch back. I'll grab this and hang on to it for now, keep up the good work!

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...