shell-exec

How do I to properly handle spaces in PHP Shell_exec?

狂风中的少年 提交于 2019-12-05 14:12:33
I'm running on win2003 server, PHP 526, via the cmd-line. I have a cmdline string: $cmd = ' "d:\Prog Files\foo.exe" -p "d:\data path\datadir" '; Trying to do this in php code $out = `$cmd`; # note use of backticks AKA shell_exec results in a failure by foo.exe as it interprets the -p arg as "d:\data". However, the same $cdm string copied to the windows shell cmdline executes successfully. How do I properly handle spaces in PHP shell_exec ? Use escapeshellarg() to escape your arguments, it should escape it with an appropriate combination of quotation marks and escaped spaces for your platform

How to execute multiple launch conditions on installer exit

混江龙づ霸主 提交于 2019-12-05 14:07:00
I've managed to get WIX to launch my application on exit, but not sure how to schedule two custom actions using the WixShellExecTarget property. One CA is to launch an app and the other is a web page based on a url from another CA. These are both launched if the appropriate checkboxes are checked. <!-- Custom action for executing app --> <Property Id="WixShellExecTarget" Value="[#Application.exe]" /> <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" /> <!-- Custom action for executing Webbrowser --> <Property Id="???" Value="[CONFIGWIZARDURL]" />

Two Shell_Exec Command with PHP button but still in the One powershell?

好久不见. 提交于 2019-12-05 12:25:30
I have Powershell syntax that can get data using ReadExisting(), but the problem is... that syntax must compele php condition before (and some shell_exec syntax when page load) I trying Get COM1 Data using powershell, and its working with this code cmd powershell in that image, the first ReadExisting() can't declare the output because the device in COM1 not showing new result, when the devices show the result, trying the ReadExisting() again and i get what i want. So (what in my opinion) the logic i should implement on PHP is : - Execute $port and $port.Open() first - Execute ReadExisting()

php system() shell_exec() hangs the browser [duplicate]

时光总嘲笑我的痴心妄想 提交于 2019-12-05 09:57:18
Possible Duplicate: Asynchronous shell exec in PHP i need to run a java program in the background. process.php contains shell_exec("php php_cli.php") php_cli.php contains shell_exec("java -jar BiForce.jar settings.ini > log.txt"); I am calling process.php asynchronously using ajax When i click the link in the webpage that calls ajax function (for running process.php) the webage shows "loading". when i click other links at the same time it does not responds. The java program takes about 24 hours to finish executing, so user will not wait until the execution ends. The problem is that the browser

How to get shell_exec to run on IIS 6.0

浪子不回头ぞ 提交于 2019-12-05 09:44:04
The Problem I have a PHP script that uses shell_exec to run a pdf-to-text converter. To simplify the problem I've created a short script that uses shell_exec to just echo the output of the dir command. <?php $cmd = 'C:\\WINDOWS\\system32\\cmd.exe /c '; echo shell_exec($cmd.' dir'); ?> When I run this on my Apache server, everything works as expected. When I switch to IIS, it's as though the line is skipped entirely: no errors, no output, no logs, no nothing. Unfortunately, I need to use IIS because I'm going to authenticate my users against active directory. Here's what I've tried so far:

shell_exec with windows path not running [closed]

纵然是瞬间 提交于 2019-12-05 06:06:39
I am trying to run a command using shell_exec but its not returning any output. When I copy the command into command prompt it works like a charm. Here is the command I'm trying to run. $result = shell_exec('android update project -p "C:\xampp\htdocs\appBuilder" -t 1'); $result is returning an empty string. When I run the command in command prompt, it shows a message saying the build.xml file was generated successfully. It should be showing the success message in $result . If I run just the command android update project -p "C:\xampp\htdocs\appBuilder" -t 1 in command prompt, it works. FYI:

Unable to execute child_process.exec() when path has spaces

半腔热情 提交于 2019-12-05 00:29:32
I am using appjs * and I want to execute a command to open a folder. What I have var path = __dirname + '/folder to open/'; // path = C:\Program Files\myapplication/folder to open/ require("child_process").exec("start " + path); Error Could not find file C:\Program What I tried I already tried to escape the spaces, that didn't work. var path = __dirname + '/folder to open/'; path = path.replace(' ', '\ '); // path = C:\Program Files\myapplication/folder to open/ require("child_process").exec("start " + path); When I put the path between quotes, No folder is opened, only another prompt. var

Getting Network Client MAC address, Syntax issue using PhP

柔情痞子 提交于 2019-12-04 14:25:17
问题 Actually the below coding is working fine, if I provide the ip address directly inside the shell_exec() $mac = shell_exec('arp -a 192.168.0.107'); If, I get the ip of the client from his system and stored in a variable and call the same, as given below, $mac = shell_exec('arp -a' . escapeshellarg($ip)); The output is not generating. Here is the Full code: <?php $ip = $_SERVER['REMOTE_ADDR']; $mac = shell_exec('arp -a'. escapeshellarg($ip)); //Working fine when sample client IP is provided...

PHP - Any chance to run GUI program through exec()?

百般思念 提交于 2019-12-04 10:08:17
i need to run a web browser (chrome - firefox ..) using exec i have tried to do it using bat file (this method mentioned here ) C:\Users\farok\AppData\Local\Google\Chrome\Application\chrome.exe www.google.com when i open the file using windows every thing goes well but nothing happened when i open it using exec and i have tried to do it using jar file by BrowserControl class BrowserControl.displayURL("www.google.com"); and the same as bat file happened so is there any way to do it? note:im using wamp 2.2 ,Apache 2.0 , PHP V5.3.8 Update i found that after i run this command exec('"C:\Program

PHP running multiple scripts concurrently

◇◆丶佛笑我妖孽 提交于 2019-12-04 07:09:52
I have an array with object server like this: Array ( [0]( ( [id] => 1 [version] => 1 [server_addr] => 192.168.5.210 [server_name] => server1 ) ) [1]( ( [id] => 2 [server_addr] => 192.168.5.211 [server_name] => server2 ) ) ) By running the code below, I'm able to get the desired output foreach ($model as $server) { $cpu_usage = shell_exec('sudo path/to/total_cpu_usage.sh '.$server->server_addr); $memory_usage = shell_exec('sudo path/to/total_memory_usage.sh '.$server->server_addr); $disk_space = shell_exec('sudo path/to/disk_space.sh '.$server->server_addr); $inode_space = shell_exec('sudo