Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Running a Script Silently on Windows

by Dru (Hermit)
on Oct 09, 2005 at 16:10 UTC ( #498592=perlquestion: print w/replies, xml ) Need Help??
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

Replies are listed 'Best First'.
Re: Running a Script Silently on Windows
by Corion (Pope) 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.

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.

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://498592]
Approved by Corion
help
Chatterbox?
and the voices are still...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2018-07-17 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (372 votes). Check out past polls.

    Notices?