Run an EXE

This is a discussion on "Run an EXE" within the PHP Forum section. This forum, and the thread "Run an EXE are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 29th, 2007, 22:01
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Run an EXE

How can I run an exe via a PHP script?
I tried something like this just to run notepad:
PHP: Select all

exec('notepad.exe'$o$r); 

But I don't think that is the right way.
Could someone explain how I can run an executable file by giving the path to it?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote

  #2 (permalink)  
Old Dec 30th, 2007, 09:18
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Run an EXE

So what do you want to get from the exe?

You can use

PHP: Select all



shell_exec
('c:/full/path/to/notepad.exe'); 
To get the output from notepad
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #3 (permalink)  
Old Dec 30th, 2007, 10:48
saltedm8's Avatar
Lead Administrator

SuperMember
Join Date: Nov 2005
Location: Always About
Age: 27
Posts: 1,298
Blog Entries: 1
Thanks: 1
Thanked 6 Times in 6 Posts
Re: Run an EXE

considered using the standard PHP commands EXEC() or SYSTEM()?

http://www.php.net/manual/en/ref.exec.php
__________________
My Recipe forum...don't click here
Last Blog Entry: Basic Advice for newbies (Feb 1st, 2008)
Reply With Quote
  #4 (permalink)  
Old Dec 30th, 2007, 14:59
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Run an EXE

I tried shell_exec('C:\WINDOWS\system32\notepad.exe');
Error was:
Quote:
Warning: shell_exec() [function.shell-exec]: Unable to execute 'C:\WINDOWS\system32\notepad.exe' in C:\Web\vbforum\vBulletin 3.6.8\upload\prog.php on line 2
Done
I don't need anything from the program just need it to run.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #5 (permalink)  
Old Jan 1st, 2008, 10:38
simonb's Avatar
Blog Moderator

Join Date: Dec 2006
Location: Norwich
Posts: 677
Blog Entries: 4
Thanks: 4
Thanked 2 Times in 2 Posts
Send a message via Skype™ to simonb
Re: Run an EXE

Alex Did you get it to work??
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Reply With Quote
  #6 (permalink)  
Old Jan 1st, 2008, 11:03
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Run an EXE

No I would of said.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #7 (permalink)  
Old Jan 1st, 2008, 11:09
simonb's Avatar
Blog Moderator

Join Date: Dec 2006
Location: Norwich
Posts: 677
Blog Entries: 4
Thanks: 4
Thanked 2 Times in 2 Posts
Send a message via Skype™ to simonb
Re: Run an EXE

ok sorry
Last Blog Entry: Whats your Niche? (Jun 10th, 2008)
Reply With Quote
  #8 (permalink)  
Old Jan 10th, 2008, 22:53
Reputable Member
Join Date: Jan 2008
Location: Pasig
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Run an EXE

So, is there anyway to run an exec program using PHP, e.g. MS office, photoshop
Reply With Quote
  #9 (permalink)  
Old Jan 10th, 2008, 23:06
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Run an EXE

Yeah, the COM class is one way.
I don't think you can control the apps though.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #10 (permalink)  
Old Jan 10th, 2008, 23:15
Reputable Member
Join Date: Jan 2008
Location: Pasig
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Run an EXE

What do you mean you cannot control the applications? But you can open it using PHP right?
Reply With Quote
  #11 (permalink)  
Old Jan 11th, 2008, 00:09
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Run an EXE

Yeah, open but not sure if you could open MS Word, write text, format it and save it from a PHP script.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #12 (permalink)  
Old Jan 11th, 2008, 00:25
Reputable Member
Join Date: Jan 2008
Location: Pasig
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Run an EXE

OK, thanks for that info. Very helpful....
Reply With Quote
  #13 (permalink)  
Old Jan 11th, 2008, 02:55
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: Run an EXE

Seems that someone else's problem has been solved
How about your's Alex?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #14 (permalink)  
Old Jan 11th, 2008, 09:40
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,770
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: Run an EXE

Nope.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 20:47.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43