Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Start Program

Status
Not open for further replies.

digatle

Technical User
Oct 31, 2003
85
0
0
US
How, in PHP, do I make it so that I run c:\windows\notepad.exe?

Digatle
 
As far as i know you cannot start external programs through php. In any event most servers that use php are linux based and wouldn't have notepad installed.

Why would you wnat to do this? Perhaps someone could provide an alternative solution.

MrBelfry
 
What they wanted me to add to our intranet was the ability to execute local programs. So I thought I would start with notepad. Everyone here uses Windows XP and has notepad at c:\windows\notepad.exe. So I'm trying to find a way (routeen whatever) to being able to click on an image located on the webpage to start the application.

Digatle
 
I don't think you can do this using php. It might be possible with ActiveX or Java. If it was possible because PHP executes on the server then you would probably be only able to start notepad on the server which would slow your server right down.

MrBelfry
 
Well there you go. Just been looking through the php manual and you can use the exec function to execute an external program. Clearly I am stupid so don't listen to my advice!

MrBelfry
 
But it will execute server side, as PHP is a server side program, this won't open the user's version of notepad, but will open it on the server side. He'll need to do it with Java or Active X.
 
A cheap way to force open an application client-side like Word is to make a link with mime-type that Word normally opens. Problem, I guess, is text files will be displayed on the browser automatically. If you can configure all your browsers not to open plain text files and force open Notepad, all you have to do is make a blank text file.

You'd also have to get through the browsers having to ask "Do you want to save this or open the file?"

If my boss asked me to do something like that, I'd have made my own browser for distribution at the office and make my links in a way the browser knows how to interpret like

Code:
<a href=&quot;notepad:blank&quot;>
 
I think the idea is more to open a program like notepad on the client side that opens a file that is server side. While not the most &quot;secure&quot; way of doing things of course he's trying to find a way around not using something like Microsoft Sharepoint.

Digatle

xDigatle.png
 
If he's trying to open a server-side file in local notepad, if they have MSnetwork running on client machines and on the server (or server running Samba) then he could use the MIME format trick with a PHP supplied name...

First page has a form asking for the file name,
page 2 appends the network drive letter and provides a link,
clicking the link (with notepad opens a new notepad to the files specified).

The down side is that they have to be on the same internal network, the server has to be mapped to the same drive letter on all computers, and the text files would have to open in notepad on all machines.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top