473,406 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How can I execute a command from php on Windows

Just I want to execute a command through PHP program.
Thanx & Regards
Mahmood Ali
Feb 8 '08 #1
8 9182
harshmaul
490 Expert 256MB
Hii,

what do you mean you want to execute a command.
Do you eant to execute the command on the client or the server?
what kind of command?
Feb 8 '08 #2
Markus
6,050 Expert 4TB
have a look at exec()

:)
Feb 8 '08 #3
harshmaul
490 Expert 256MB
True,
but exec() is for server side, if you want client side you will need to look at "content dispositioning" the file in to a batch file....

eg...

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. header("Content-type: application/bat");
  3. header("Content-Disposition: attachment; filename=notepad.bat");
  4. notepad.exe
  5. ?>
The above will load up notepad on the client.
Feb 8 '08 #4
Thanx, but exec() is not working.......
just I want to run "mstsc.exe" command when I click on anchor Tag: <a href="test.php">Click to Run</a>
Feb 9 '08 #5
Thanx,
on server side
just I want to run "mstsc.exe" command when I click on anchor Tag: <a href="test.php">Click to Run</a>
-------------------------------------------------
Feb 9 '08 #6
harshmaul
490 Expert 256MB
Hi,

So letme gety this write. You want a web site, that when a user clicks a link, they get a prompt to log in to a remote PC/Server?
Feb 9 '08 #7
Yes

Thank you so much.
Feb 12 '08 #8
harshmaul
490 Expert 256MB
Hi, in a new html page write the following code....

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. header("Content-type: application/bat");
  3. header("Content-Disposition: attachment; filename=notepad.bat");
  4. mstsc.exe
  5. ?>
When you run it the browser will ask if you would like to download it, and then if you click run it will launch copmmand prompt, and load up the remote desktop...

Alternatively if the page is going to be secure you could do it like this.....
but don't forget to change the variables to those appropriate to you... (i started all you should change with **

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. header("Content-type: application/rdp");
  3. header("Content-Disposition: attachment; filename=rdp.rdp");
  4. ?>
  5. screen mode id:i:2
  6. desktopwidth:i:**SCREEN WIDTH
  7. desktopheight:i:**SCREEN HEIGHT
  8. session bpp:i:16
  9. winposstr:s:0,1,4,4,1056,562
  10. auto connect:i:0
  11. full address:s:**HOST
  12. compression:i:1
  13. keyboardhook:i:2
  14. audiomode:i:0
  15. redirectdrives:i:0
  16. redirectprinters:i:1
  17. redirectcomports:i:0
  18. redirectsmartcards:i:1
  19. displayconnectionbar:i:1
  20. username:s:**LOGIN
  21. domain:s:
  22. alternate shell:s:
  23. shell working directory:s:
  24. disable wallpaper:i:0
  25. disable full window drag:i:0
  26. disable menu anims:i:0
  27. disable themes:i:0
  28. bitmapcachepersistenable:i:1
  29.  
Feb 12 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: tom | last post by:
Problem: In PHP, need to execute a program in (freebsd terms) /usr/local/bin in meta-terms: int i; i = (arguments); There seems to be quite a few execution methods in PHP (sorry in advance...
1
by: Miguel | last post by:
Hello, I'm trying to execute an Network command with PHP exec() function but i can't. The PHP script looks like the following: <?php ... exec('\\PTtype\Myapp'); ...
8
by: wj | last post by:
Hi all, I wonder if it is possible to execute PHP-code automatically. Is it for example possible to sent an e-mail every day at lets say 9.00 pm automatically to adresses from a database? ...
1
by: Matt | last post by:
I used to execute a command line script in IIS 4 using Dynuexec. This is a third part server object I installed on the server (http://www.dynu.com/dynuexec.asp). I installed this object onto my...
5
by: Gustavo Randich | last post by:
Hello, I'm writing an automatic SQL parser and translator from Informix to DB2. Now I'm faced with one of the most difficult things to translate, the "foreach execute procedure" functionality...
6
by: Joseph | last post by:
Hi, I am trying to develop a C# application that will run on Windows that will do the following * Select file name to process * FTP the file to a UNIX server * Process this file on UNIX using a...
4
by: Chris | last post by:
I posted this in the C# language group, then thought it might be more appropriate in this group. I would not cross-post except I want the answer so badly. I built small C# Web and Web Service...
7
by: spec | last post by:
Hi all, I know nothing about Python. What I need to do is to get a Python script to execute a local shell script. I do not need any output. What would be th eeasiest way to accomplish this? ...
1
by: raocheng | last post by:
Please see the following code. Suppose I have many shell commands to be executed. And I don't want to fork a sub shell for each command(eg: status,output = commands.getstatusoutput(cmd)) because...
2
by: rcook349 | last post by:
I'm trying to automate our builds and publishes of our Windows application (deployed to a website via ClickOnce). I'm getting close, I think, on the commands I need to execute. However, how do...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.