Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 13th, 2006, 9:26 PM   #1
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
Execute Commands with Command Prompt

I've been working on a way to add a whole bunch of users to windows server 03. I've made one PHP file that will create me a batch file to add the users but that requires me to also run the batch file. I remembered seeing something on php.net about executing commands. I've tried system() and exec() and I've been getting these errors: "Warning: system() [function.system]: unable to fork [echo hello] in c:\inetpub\wwwroot\test.php on line 7" and "Warning: exec() [function.exec]: Unable to fork [dir] in c:\Inetpub\wwwroot\test.php on line 4". I was wondering if anyone had any info on this.
PhilBon is offline   Reply With Quote
Old Aug 13th, 2006, 10:08 PM   #2
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
http://ca3.php.net/manual/en/ref.exec.php
http://www.google.ca/search?hl=en&q=...G=Search&meta=

Check those links at search google if you haven't already found a source or tutorial, or something you can refer to. If you have found something that you are following, post the link, and post some of your code. I've never done what you are trying to do here, but I figure you will probably geta response, or responses faster(and a solution) if you post some code.
Booooze is offline   Reply With Quote
Old Aug 14th, 2006, 2:56 AM   #3
v0id
Hobbyist Programmer
 
Join Date: Apr 2006
Posts: 155
Rep Power: 3 v0id is on a distinguished road
I haven't tried it too, but I would think you could use the system. But you say it doesn't work, so I don't know?
system("some command", $var);
if($var)
    // Do something
__________________
-- v0id
v0id is offline   Reply With Quote
Old Aug 14th, 2006, 12:37 PM   #4
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Quote:
Originally Posted by v0id
I haven't tried it too, but I would think you could use the system. But you say it doesn't work, so I don't know?
system("some command", $var);
if($var)
    // Do something
Hence why I said maybe he should post the code? It's hard to diagnose a problem without it. Because it could be a error on his side.
Booooze is offline   Reply With Quote
Old Aug 14th, 2006, 1:50 PM   #5
v0id
Hobbyist Programmer
 
Join Date: Apr 2006
Posts: 155
Rep Power: 3 v0id is on a distinguished road
Of course, I just gave it a try, maybe he didn't do it in that way.
__________________
-- v0id
v0id is offline   Reply With Quote
Old Aug 14th, 2006, 2:12 PM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
If the application doesn't bring the ability to set some variables to the outside world, you're going to have to do some very arcane things to affect them. Does that answer your question? If ifs and buts were candy and nuts, we'd all have a Merry Christmas. Same goes for voodoo and unfounded guesses/hope.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Aug 14th, 2006, 2:28 PM   #7
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Quote:
Originally Posted by v0id
Of course, I just gave it a try, maybe he didn't do it in that way.
How would we know if he hasn't posted any code? It has something to do with exec, shell, or shell exec. He says hes tried shell and exec and it doesn't work. What I'm saying is that if you google the question, there are lots of results. If he is still having trouble, there may very well be something wrong with the code. Anyways, he ain't getting any anwsers unless he posts back That is, unless he already figured it out.:p
Booooze is offline   Reply With Quote
Old Aug 15th, 2006, 1:47 AM   #8
v0id
Hobbyist Programmer
 
Join Date: Apr 2006
Posts: 155
Rep Power: 3 v0id is on a distinguished road
I know, as i said I just gave it a try, maybe it was it.
Quote:
Originally Posted by PhilBon
I've tried system() and exec() and I've been getting these errors: "Warning: system() [function.system]: unable to fork [echo hello] in c:\inetpub\wwwroot\test.php on line 7"
He tried system(), so I thinked it was maybe that.
__________________
-- v0id
v0id is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unix commands compatible with Windows? titaniumdecoy Bash / Shell Scripting 7 Oct 5th, 2006 7:25 AM
PHP system commands ktsirig PHP 6 Oct 4th, 2005 1:24 AM
Execute File Batch Commands johndoe Other Programming Languages 0 Sep 2nd, 2005 8:00 AM
A simple script to execute a command package satimis Bash / Shell Scripting 3 Aug 12th, 2005 11:28 PM
how to send commands to a prompt? acab Python 4 Apr 28th, 2005 5:20 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:52 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC