exec for EXE with arguments

This is a discussion on exec for EXE with arguments within the PHP General forums, part of the PHP Programming Forums category; hi i'd like to call an exe with several parameters like this: the parameter -name= must have quotes from ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-08-2003
Juerg Zgraggen
 
Posts: n/a
Default exec for EXE with arguments

hi

i'd like to call an exe with several parameters like this:
the parameter -name= must have quotes from beginning til end because of the
Spaces between.
C:/Programme/Apache
Group/Apache2/htdocs/myexe.exe -action=add -name="My Own Task"

so i tried this in PHP... but it dows not work! It only works when i take
out the \"... however i can't do this because my exe neeads the parameter
like this:

// ---- CODE ------
$execString = "\"C:/Programme/Apache Group/Apache2/htdocs/myexe.exe\""
// i have to use \" because of the spaces
." -action=add"
." -name=\"My Own Task\""; // i have to use \"
because of the spaces
exec(escapeshellarg($execString), $arrRes, $iret);
print_r($arrRes);
// ---- CODE ------
$arrRes is empty although the exe ALWAYS gives a return value

on www.php.net i found the functions escapeshellarg and escapeshellcmd.
could these functions be the solution i'm looking for? i really don't know
how to use them for my case.

can anybody give me a hint please...
Regards,
Juerg






Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:52 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0