I have tried posting in PHP forum but no reply. I think it's not a problem with PHP anyway so perhaps someone in this forum can help.
When I use the code below to try and launch notepad.exe from within a PHP script using the exec() function, I can see the process has been added to the process list (from task manager) but notepad hasn't started! The process cannot be forced to quit either.
The exec() function seems to work but I want the application to launch properly - is there a trick when using the command prompt to having a programme actually launch, as compared to just having the process start? -
$cmd='notepad.exe'
-
exec($cmd);
-
My system is: win2k pro, apache 2, php 5.2
Thanks!
6 11633
I have tried posting in PHP forum but no reply. I think it's not a problem with PHP anyway so perhaps someone in this forum can help.
When I use the code below to try and launch notepad.exe from within a PHP script using the exec() function, I can see the process has been added to the process list (from task manager) but notepad hasn't started! The process cannot be forced to quit either.
The exec() function seems to work but I want the application to launch properly - is there a trick when using the command prompt to having a programme actually launch, as compared to just having the process start? -
$cmd='notepad.exe'
-
exec($cmd);
-
My system is: win2k pro, apache 2, php 5.2
Thanks!
Try to download this program, it helps: http://www.microsoft.com/technet/sys...es/psexec.mspx
After installing it....
try to use this format: -
exec("psexec -d blah.bat");
-
-------------------------------------------------------------------------------------------------------------
If you don't like the above solution
You can also use the run....... -
-
//start Notepad.exe minimized in the background:
-
$WshShell = new COM("WScript.Shell");
-
$oExec = $WshShell->Run("notepad.exe", 7, false);
-
-
//start a shell command invisible in the background:
-
$WshShell = new COM("WScript.Shell");
-
$oExec = $WshShell->Run("cmd /C dir /S %windir%", 0, false);
-
-
/*start MSPaint maximized and wait for you to close it before continuing the
-
script:*/
-
$WshShell = new COM("WScript.Shell");
-
$oExec = $WshShell->Run("mspaint.exe", 3, true);
-
-
Hope this helps....
Hi dafodil
Thanks very much for your reply - I think I'm very close.
Tried both methods. They both seem to work, except that the application is never maximised.
On the second method, for the first one (...->Run(notepad.ex e, 7, false); ), the process launches (according to task manager) and I can close it with task manager.
For the third one (...->Run(mspaint, 3, true); ), the script continues running and the application starts in the background but doesn't maximise. The script only stops running when I close the process in the task manager.
Perhaps it's something preventing Apache telling windows to maximise it? I've had a look on some sites for some clues but I can't seem to work it out...
Hi dafodil
Thanks very much for your reply - I think I'm very close.
Tried both methods. They both seem to work, except that the application is never maximised.
On the second method, for the first one (...->Run(notepad.ex e, 7, false); ), the process launches (according to task manager) and I can close it with task manager.
For the third one (...->Run(mspaint, 3, true); ), the script continues running and the application starts in the background but doesn't maximise. The script only stops running when I close the process in the task manager.
Perhaps it's something preventing Apache telling windows to maximise it? I've had a look on some sites for some clues but I can't seem to work it out...
Try this to give Apache permission to interact with your desktop:
Start>Run>servi ces.msc
Right click "Apache..." , select properties.
Click on the "LOG ON" tab
Check the box "Allow this service to interact with desktop"
Click OK
Restart Apache
Hi Dafodil
I don't seem to be having much luck here. Followed those steps but no effect.
The exec() function definitely works because I can run commands directly through it. Simple example would be ipconfig which works and returns expected output with the following: -
exec("ipconfig /all",$output);
-
var_dump($output);
-
I don't know why it refuses to maximise or start applications. Also seems to have trouble executing batch files - exactly the same command in a batch file doesn't work.
I suppose I'll stick to using simple commands with the exec() function for now. Any further ideas would be really welcome but thanks for your help up to now!
Hi Dafodil
The problem seems to be fixed. Think the last part helped although only after I restarted my whole system for some reason.
And I realised that some of my commands in exec() weren't properly escaped so they weren't being recognised.
Thanks for your help!
Henry
Hi Dafodil
The problem seems to be fixed. Think the last part helped although only after I restarted my whole system for some reason.
And I realised that some of my commands in exec() weren't properly escaped so they weren't being recognised.
Thanks for your help!
Henry
Welcome. Post again whenever you face any problem.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Brett Gerhardi |
last post by:
Hi all, I'm having a nightmare with Windows Installer projects and souce
control. My situation is that I have a few related windows application /
dlls, some generic shared library files and a windows installer to install
it. I have all of these in the same solution to enable easy debugging and
maximum flexibility.
I want my source control to be something like this (from the /$ root)
MyBigApplication
- vb.net main windows application
|
by: Shi Jin |
last post by:
Hi there,
I am now having a puzzle regarding what a function call actually does when
called.
I have a simple code to see what's going on. It is simply calling another
simple function from main().
The disassembled code for the function under linux (with gcc) looks like this:
pushl %ebp ;push old %ebp
movl %esp, %ebp ;make new stack frame
|
by: Guy |
last post by:
I have extended the datetimepicker control to incorporate
a ReadOnly property.
I have used the new keyword to implement my own version
of the value property, so that if readonly == true then
it will not set the value of the control and will leave
the checked status of the checkbox to false when a user
selects a new date.
this works fine when using the control on a win2k machine
but if we use it on a win XP box and call
|
by: Chris Schremser |
last post by:
I have a question regarding embedded controls in IE. We are looking to
replace a small VB ActiveX control with something written in C#. We have
written the control and it instantiates correctly in IE using the <object>
tag. My question is this. When the browser visits the pages and requests
the object from the server, it appears to be making many unnecessary
requests for configuration files and resources files as well. I am using
the...
|
by: Mobile Boy 36 |
last post by:
I'm trying to make a very simple Textbox with a FocusColor property...When
the focus
changes to the
control, the backcolor must change automaticly to the color set by the
focusColor property.
Very simple, the control works fine when creating it dynamicly from code.
My aim is to add design functionality, so I can use it from the Visual
Studio .Net toolbox.
When I compile my code, no errors are reproted and Visual studio leaves a
| |
by: Matt Theule |
last post by:
I need to be able to allow users to drag files to a list box on a web
page. To this end, I created a Windows Control and hosted it in a
WebForm. When the file is dropped onto the listbox, the path of the
file is truncated down to 8.3 format (with the ~1 at the end). When the
Windows control is hosted in a windows form (for testing purposes) the
full path is displayed.
Is there some setting that will allow the full path to be displayed...
|
by: John Lau |
last post by:
Hi,
Is there documentation that talks about the page lifecycle, the lifecycle of
controls on the page, and the rendering of inline code, in a single
document?
Thanks,
John
|
by: Charts |
last post by:
I use VS2005 to build a asp.net 2.0 project. I want to be able to click a
button on the page and have a dialog window appear where I can navigate the
folders to get hold of a file path to load data from the file to a SQL Server
database. I imported System.Data.Forms which gives me access to the
FolderBrowseDialog control. The first problem is that the toolbar did not
show FolderBrowserDialog server control, so I cannot drag it to my form....
|
by: Jens Kallup |
last post by:
Hello Newsgroup,
I had program a little tool, thats output some assembler output:
---
.section .rdata, "dr"
LC1:
.ascii "eins: %g\0"
..text
..globl _dbase_main
|
by: ChopStickr |
last post by:
I have a custom control that is embedded (using the object tag) in an html document.
The control takes a path to a local client ini file.
Reads the file.
Executes the program specified in the ini on the client's PC.
After the program has ended the control looks in a client side temp folder (specified by the ini file) for an image created by the executed program.
If the image is there, then the control moves the file to a public folder...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |