By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,708 Members | 2,091 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,708 IT Pros & Developers. It's quick & easy.

system command in perl - prompt does not return back - window

P: 10
Hi All,
Greetings. May be simple issue but your help sought.
I am executing the system command like
$res=system("notepad.exe"); thro a perl file named aa.pl.

At command prompt - when I enter
perl aa.pl , I could see that notepad was opened but the control - I say as prompt ( in windows) does not return back.
It looks like perl response is hanging.
I have to stop the precess with ctrl+c

Any idea ??
Envn - Windows XP
This is perl, v5.8.9 built for MSWin32-x86-multi-thread
edit reply report
May 27 '10 #1
Share this Question
Share on Google+
2 Replies


Expert Mod 100+
P: 589
The system function will block until the executed command completes, which in this case is when you close/exit notepad.

Please read: `perldoc -f system` http://perldoc.perl.org/functions/system.html

If you want to create a detached process, you could use the Win32::Process module.
http://search.cpan.org/~jdb/Win32-Pr....14/Process.pm
May 27 '10 #2

P: 6
@Selva123
You can use the exec command to create a detached process.

Expand|Select|Wrap|Line Numbers
  1. exec("notepad.exe")
Jun 8 '10 #3

Post your reply

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