note 25068 deleted from function.exec by cmb

From: Date: Sun, 22 Sep 2019 07:24:40 +0000
Subject: note 25068 deleted from function.exec by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212283@lists.php.net to get a copy of this message
Note Submitter: iceburn at dangerzone dot c o m ---- This seems to work for me on win2k server w/ iis 5 w/ php 4.2.2.... <?php if(getenv("OS")!="Windows_NT") { echo "This script runs only under Windows NT"; } $tmp = exec("usrstat.exe Domain", $results); foreach ($ping_results as $row) echo $row . "<br>"; echo "done"; ?> For those that don't know what usrstat is, it's a program that is the admin pack for win2k that lists users in a domain and thier last logon time. I used it as the example to show that arguments can be passed (the domain). The one "gotcha" is that usrstat.exe must be in the system path...ie if you are at the server w/ a command window, anything you can type w/o typing in a path, works. Try it with ping, since that should be in system32 for just about everyone... I've tried things like: exec("c:\temp\usrstatexe... exec("cmd /c c:\temp\usrstat.exe... but can't seem to get anywhere with those... even putting the exe on a shared drive with identical paths for the client and server to the exe doesn't work (don't know why that would fix it, but was just trying things...)

« previous php.notes (#212283) next »