Gossamer Forum
Home : General : Perl Programming :

call batch file from webpage

Quote Reply
call batch file from webpage
recently. i am testing Win32-ShutDown


the code is simple as below and make it a file named shutdown.pl
(shutdown.pl)------------------------------------------
use Win32::ShutDown;
#Win32::ShutDown::ForceShutDown(); # Turns off the PC, no matter what :-)
exit;



while the code is working only in dos window. while doing nothing when i call it from a webpage.

then make a batch file called shudwonbat.bat

something like below code
(shudwonbat.bat)---------------------
perl.exe C:/shutdown.pl



Then i run again from the web by below code--------------------
system ("i:/shutdown.bat");
#print " shutdown is OK now\n";
exit;


but nothing is happened again.

i wonder weather i am using the wrong way to call a batch file?

Any help would be greatly appreciated


austin
Quote Reply
Re: [courierb] call batch file from webpage In reply to
Hi,

I think the problem is going to be with User permissions. I'm not a keen user of Win32 machines, but I still have to use them :(

I've had similar problems with Win32::OLE, which doesn't work when run via a web-script, but is fine when run from a "Virtual Terminal" connection. Apparantly its down to the web-user group not having Administrator access, which is required for things like running system commands/rebooting servers/service managers/etc).

Unfortauntly, the only way I've found of getting around this, is by running the script as an administrator.

Hope that helps :)

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates