ptolomea Posted September 16, 2007 Share Posted September 16, 2007 First off I have done a search for this and there were actually 3 posts dealing with something along the same lines as me. But there were no responses, the posters did not list enough of their code to see if they had something different that I have yet to try. Here goes. I am trying to run a .vbs script from php. I do not need the output of this script as the sole purpose of the website I am building is to run this script for a file. The vbs script works flawlessly if I run cscript maintest.vbs from a command prompt here is the code for the .php <?PHP $runCommand = "C:\\ISOStuff\\mount.vbs"; $wshshell = new COM("WScript.Shell"); $wshshell->Run($runCommand); ?> now I have tryed all of the items below with and with out cscript in front. shell_exec() with the vbs file and a baseline test for what the vbs file is sposed to do.(Open a file with test permamiters that the vbs script is able to get) system() only the vbs file. this one i get a responce on the page but its just the first line of the cscript. exec() just to help here is the vbs file to set wshshell = wscript.createobject("wscript.shell") Set objEnv = WshShell.Environment("User") iso = objEnv("mountediso") wshshell.run "C:\isostuff\daemon.exe -unmount 0" wshshell.run "C:\isostuff\daemon.exe -mount 0, " & iso in the enviorment user section i have created a variable called mountediso and it holds C:\random.iso and random.iso is a small file i created that has a window pop up on autorun so i can quickly tell if the procedure worked. I am using wamp5 server (package of mysql4.1, apache2.2 and php5.2.2(CLI), and just because I saw another post on here about it, i have enabled the apache servers to allow interaction with desktop in services then rebooted Any help is apreciated Link to comment https://forums.phpfreaks.com/topic/69526-solved-run-vbs-from-php/ Share on other sites More sharing options...
ptolomea Posted September 16, 2007 Author Share Posted September 16, 2007 .. I feel dumb i was trying to run the script on the local hd of the system and trying to call it from the web server, once i moved all files into the server directory it worked enough to get an error from the 2nd app which is farther then i have gotten before Link to comment https://forums.phpfreaks.com/topic/69526-solved-run-vbs-from-php/#findComment-349381 Share on other sites More sharing options...
ptolomea Posted September 16, 2007 Author Share Posted September 16, 2007 well through playing around with the environmental scope of my scripts I figured out a way to run a vbscript and do what the vbscript was doing through php the biggest issue was that the items i was trying to run were not in the www directory on my server. here is the solution code <?PHP //system("cscript mount.vbs") exec("isostuff\daemon.exe -mount 0, isostuff\random.iso"); ?> Link to comment https://forums.phpfreaks.com/topic/69526-solved-run-vbs-from-php/#findComment-349426 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.