Windows commands requiring a GUI.



Alot of the info on this topic is from the 2010-2012 time frame and referring to XP, and basically don't work. I am using apache/php/mysql in windows 7.



When requiring a system command in windows with a GUI - such as a labview executable, notepad, etc..., others have mentioned the psexec command from sysinternals, since cmd /c wont work, but the specific use was not real clearly defined. Here is what worked for me on windows 7:



system('C:/nttools/2019/psexec \\\\10.100.100.101 -i -u administrator -p password -accepteula -nobanner C:\\htdocs\\test\\test.bat');



The path to the psexec executable is with forward slashes, the remote PC network location (which was actually the local PC, not remote) was \\ip_address with an extra backslash for each backslash so that required the 4 \'s.



The path for the command to be executed by psexec required backslashes, which also requires double backslashes.



The -i option is for an interactive program, and is required for it to properly run, otherwise it show up in the taskmanager but not be visable or execute properly if given command line arguments.



The -accepteula -nobanner is to suppress the sysinternals message box about their license.



My command to execute is really long with multiple command line inputs with many surrounded in double quotes, so I thought it would be easiest to put that in a batch file and just call the bat file. Works great, remote users loading the webpage causes the executable to pop up on the web server, do its analysis and disappear. Labview can read native excel files with active-x functions and write to a mysql data base to store results etc, so thats a pretty powerful combination of functions.