Hi all,

I am new to this perl script.

I want to open notepad.exe in perl script in the foreground.,
i.e if I give the command as system ("c:\\windows\\notepad.exe") , notepad should appear in the foreground. (should not run as a background process).

I am using Apache server on windows.

Please help me.....


Thanks in advance.

Anil

the problem with this is that your perl script will continue running in the background. Maybe that's not a problem for your application though. You can use system() or exec() or qx// or backtiks ``. Anyone of thses will open a notepad window. Since windows is almost always (or maybe is always) in the command path you can just do this:

system('notepad.exe');

or even:

system('notepad');

But If I am using APACHE server, all the process started from APACHE server will be running in the APACHE server shell context right? so even though notpad.exe is visble in the task manager process list, its not visible outside in the windows session.

so using system(), exec() or ` ` quotes doesnt make difference .

Please correct me if I am wrong.

So how to overcome this problem? Is there any setting in APACHE

Did you try any of my suggestions? I assume you mean you are using apache on a local server where notepad is installed. If so it should work.

You can use start to control even more about the notepad window. For instance,

system("start /maximized notepad");

will start notepad maximized.

Hi all,

I am new to this perl script.

I want to open notepad.exe in perl script in the foreground.,
i.e if I give the command as system ("c:\\windows\\notepad.exe") , notepad should appear in the foreground. (should not run as a background process).

I am using Apache server on windows.

Please help me.....


Thanks in advance.

Anil

are you saying you are running a web server , and then the web server will call this perl script to call notepad whenever someone click a button on a web page?

the problem with this is that your perl script will continue running in the background. Maybe that's not a problem for your application though. You can use system() or exec() or qx// or backtiks ``. Anyone of thses will open a notepad window. Since windows is almost always (or maybe is always) in the command path you can just do this:

system('notepad.exe');

or even:

system('notepad');

Hi, I just found a tool which can run the application in foreground.

I'm using PHP5 Apache2. I went to this http://www.sysinternals.com/Utilities/PsExec.html website and download the psexec tool.
After that I put this code to my webpage:

system ("psexec -i -d -s notepad.exe");

Next, I open the webpage with my M$IE, wonderful thing happen, the notepad.exe program open in foreground.

I don't know how perl script run. However, php seems very similar to perl, therefore it might work in perl script.:twisted:

Hi,

I have tried

system("psexec -i -d -s C:/WINDOWS/notepad.exe");

and when I execute the script from my browser ( IE and FireF@x ) the page does not load. When i looked in the Apache Error log there are the lines:

[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] PsExec v1.94 - Execute processes remotely\r
[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] Copyright (C) 2001-2008 Mark Russinovich\r
[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] Sysinternals - [url]www.sysinternals.com\r[/url]
[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] \r

but notepad.exe does not open.

I have also tryed this in PHP as well as perl and the command psexec -i -d -s C:/WINDOWS/notepad.exe runs exactly as desired when I run it in CMD

Regards,
Sam Rudge

Hi,

I have tried

system("psexec -i -d -s C:/WINDOWS/notepad.exe");

and when I execute the script from my browser ( IE and FireF@x ) the page does not load. When i looked in the Apache Error log there are the lines:

[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] PsExec v1.94 - Execute processes remotely\r
[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] Copyright (C) 2001-2008 Mark Russinovich\r
[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] Sysinternals - [url]www.sysinternals.com\r[/url]
[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] \r

but notepad.exe does not open.

I have also tryed this in PHP as well as perl and the command psexec -i -d -s C:/WINDOWS/notepad.exe runs exactly as desired when I run it in CMD

Regards,
Sam Rudge

I have sorted this, If anyone wants to know you need to open the service properties for apache 2.2 in services.msc and go to the LogOn tab and allow the service to interact with the desktop

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.