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
use Win32::ShutDown;
#Win32::ShutDown::ForceShutDown(); # Turns off the PC, no matter what :-)

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
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";

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

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

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)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!