[PHP] how do i launch a program on desktop

http://au2.php.net/exec

Code:
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("notepad.exe", 7, false);

Parker he wants it from the desktop silly (:!

This only works in Windows Vista, I think, but give it a shot on XP.
I highly doubt it will work on other platforms, but I haven't ever used them.

PHP:
<?php
	$winName = getenv('username'); // Windows User Account
	$program = "C:\\Users\\" . $winName . "\\Desktop\\file.exe"; // Path to Program	
	exec($program);
?>
 
That, too, will only work on the server the script is running from and in the background ;)

It is possible if the user's workstation is in the same domain as the server, or the script is running on the users computer, but you'll need psExec for it to interact with the user session.
 
You want to start a Application on the Users Desktop by let him Click on your Website.. I would be scared if that works O.o

You can write a little application and afaik you can register this tool as a handler for your own protocoll.
Lets say you call this Protocol "foo" than you can place a link on your website like "foo://notepad.exe"
if i understand everything right your application will get started by windows and receives the url ("foo://notepad.exe"). What you application do with that .. your stuff ;-)

Some URLs which can help you.. if not ask the big google:
http://stackoverflow.com/questions/389204/how-do-i-create-my-own-url-protocol-eg-so
http://msdn.microsoft.com/en-us/library/aa767914(VS.85).aspx
 
Parker he wants it from the desktop silly (:!

This only works in Windows Vista, I think, but give it a shot on XP.
I highly doubt it will work on other platforms, but I haven't ever used them.

PHP:
<?php
	$winName = getenv('username'); // Windows User Account
	$program = "C:\\Users\\" . $winName . "\\Desktop\\file.exe"; // Path to Program	
	exec($program);
?>

It does not need double slashes if I'm not wrong.
But indeed this won't work for all but for the server.Why don't you simple make a file with extension: .wma or something and force the user to execute (let's say) Windows Media Player.You said something about Play Live button and that's why I'm telling so...

I don't remember right now.I had found a snippet of code doing the thing you want but it's somewhere and I can't find it right now ^^ :rolleyes:

-Blane
 
Back