citro Posted April 4, 2013 Share Posted April 4, 2013 Hi, how can I run ".vbs" script file from html or php code? For example I have "script.vbs" file and clicking button in html file script will execute. Quote Link to comment Share on other sites More sharing options...
requinix Posted April 4, 2013 Share Posted April 4, 2013 Not possible. Quote Link to comment Share on other sites More sharing options...
citro Posted April 4, 2013 Author Share Posted April 4, 2013 Really there is no other options to run this script from the web interface? Quote Link to comment Share on other sites More sharing options...
Psycho Posted April 4, 2013 Share Posted April 4, 2013 What, exactly, are you trying to accomplish? I "believe" you can execute VBScript code that is included in the web pages the same as JavaScript - but it will ONLY work on IE. At least it used to. But, allowing that is a HUGE security risk, so it would be a safe bet that it might not work in current versions of IE. Or, are you trying to execute a vbs file that exists on the user's PC? Either way, you are going to have some challenges to overcome. The only solution might be to have a Java Plug-In (not JavaScript) created to perform the actions you want performed. but, that would require the user to actually install the Plug-In. Quote Link to comment Share on other sites More sharing options...
citro Posted April 4, 2013 Author Share Posted April 4, 2013 What, exactly, are you trying to accomplish? I "believe" you can execute VBScript code that is included in the web pages the same as JavaScript - but it will ONLY work on IE. At least it used to. But, allowing that is a HUGE security risk, so it would be a safe bet that it might not work in current versions of IE. Or, are you trying to execute a vbs file that exists on the user's PC? Either way, you are going to have some challenges to overcome. The only solution might be to have a Java Plug-In (not JavaScript) created to perform the actions you want performed. but, that would require the user to actually install the Plug-In. I have two computers. On first computer is .vbs scripts which executes "netsh" commands. I need to run script from second computer with web interface this script executes script on first computer. Quote Link to comment Share on other sites More sharing options...
Psycho Posted April 4, 2013 Share Posted April 4, 2013 OK, so on the Second Computer (The PC where the user is viewing the web page) you want to initiate the execution of the VBScript on the first computer (where the VBScript exists). Is the first computer also the one where the web server is running? If yes, you can have a PHP script that uses exec() to run the VBScript file. The manual for that function has some examples. If the first PC is not where the Web server is running it would get trickier. You would have to create some kind of service that runs on that PC waiting for a request to run the file. That service would need to monitor a certain port for a request. You could then create a PHP script that generates the request to that machine to run the file. It not impossible, but it beyond what I could help with. Quote Link to comment Share on other sites More sharing options...
citro Posted April 5, 2013 Author Share Posted April 5, 2013 OK, so on the Second Computer (The PC where the user is viewing the web page) you want to initiate the execution of the VBScript on the first computer (where the VBScript exists). Is the first computer also the one where the web server is running? If yes, you can have a PHP script that uses exec() to run the VBScript file. The manual for that function has some examples. If the first PC is not where the Web server is running it would get trickier. You would have to create some kind of service that runs on that PC waiting for a request to run the file. That service would need to monitor a certain port for a request. You could then create a PHP script that generates the request to that machine to run the file. It not impossible, but it beyond what I could help with. Web server is only on the second pc! If I can't run this .vbs script so easily maybe is some chance to run Windows CMD command line commands which are in .vbs script? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.