Dru has asked for the wisdom of the Perl Monks concerning the following question:
Greetings Monks,
I wrote a script to install some security software on our user's Windows machines. Right now it runs in a dos window and has minor interaction. I've been asked if I could run this script silently since it will be deployed via SMS. I've been able to modify it, so it prints all error messages and such to a log file instead of to standard out and does not require any interaction from the user. Does anyone have any suggestions on how to make the script run without launching any windows? The script only needs to run once, and then deletes itself.
Thank you in advance for any suggestions,
Dru
Re: Running a Script Silently on Windows
by Corion (Patriarch) on Oct 09, 2005 at 16:12 UTC
|
Run your script by using wperl.exe instead of perl.exe. wperl.exe doesn't open a console ("DOS") window. The user can still kill the program through the task manager if she is quick enough, at least if the process is run as the user. You should consider running the process as a different user (like the SMS user) instead.
| [reply] [Watch: Dir/Any] |
Re: Running a Script Silently on Windows
by pg (Canon) on Oct 09, 2005 at 16:24 UTC
|
As Corion mentioned, use wperl. Other than the situation you have, the other major usage of wperl is for GUI applications. With wperl, once you start your GUI, you can just close the console window. Otherwise in the situation where you have multiple GUI applications, you will have to leave a set of consoles open, which is really ugly.
| [reply] [Watch: Dir/Any] |
Re: Running a Script Silently on Windows
by Withigo (Friar) on Oct 10, 2005 at 03:08 UTC
|
Have the script run as a windows service, which is the rough equivalent to a *nix daemon, so there is no possibility of user interaction. I have had good success with this for similar scripts. Download the "Resource Kit" from somewhere on Microsoft's site, which contains the utilities instsrv.exe and srvany.exe that allow you to install a service. There are lots of how-to documents for this procedure.
Here's one to get you started: tacktech.com
| [reply] [Watch: Dir/Any] |
|