note 123769 added to function.system
| From: | Anonoymous@php.net | Date: | Thu, 11 Apr 2019 11:06:27 +0000 |
| Subject: | note 123769 added to function.system | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210588@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 208.43.231.9
Probable Submitter: 82.199.157.34 (proxied: 165.225.39.8)
----
Manual Page -- http://php.net/manual/en/function.system.php
Edit -- https://master.php.net/note/edit/123769
Del: integrated -- https://master.php.net/note/delete/123769/integrated
Del: useless -- https://master.php.net/note/delete/123769/useless
Del: bad code -- https://master.php.net/note/delete/123769/bad+code
Del: spam -- https://master.php.net/note/delete/123769/spam
Del: non-english -- https://master.php.net/note/delete/123769/non-english
Del: in docs -- https://master.php.net/note/delete/123769/in+docs
Del: other reasons-- https://master.php.net/note/delete/123769
Reject -- https://master.php.net/note/reject/123769
Search -- https://master.php.net/manage/user-notes.php