Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Windows 10 Command Prompt

by Discipulus (Canon)
on Apr 29, 2020 at 12:56 UTC ( [id://11116203]=note: print w/replies, xml ) Need Help??


in reply to Windows 10 Command Prompt

Hello PilotinControl

I see no differences in win7 win10 behaviour for the following simple script (removing sounds and other amenities)

use strict; use warnings; $|++; #autoflush output quit(); sub quit { my $sleep = 3; while ( $sleep ){ print "\rQuitting in $sleep sec."; sleep 1; $sleep--; } exit; }

I find no differences even if the .pl program is doubleclicked AND .pl files are associated with a valid perl.exe interpreter. Is this your use case? Because normally a command prompt previously started is persistent. Anyway in both circumstances and in both OSs I see no different behaviour.

You can be interested in a more complex solution as you can read in Handling MSWin Script Output, where I posted the following code:

use strict; use Win32::Process::Info; my $pihandle = Win32::Process::Info->new(); my @procinfo = $pihandle->GetProcInfo(); my $ParentPID; my %ProcNames; foreach my $PIDInfo (@procinfo) { $ProcNames{$PIDInfo->{ProcessId}} = $PIDInfo->{Name}; if ($PIDInfo->{ProcessId} == $$) { $ParentPID = $PIDInfo->{ParentProcessId}; last; } } print "Parent's name is [", $ProcNames{$ParentPID}, "]\n"; if ( $ProcNames{$ParentPID} eq 'OpenWith.exe' or $ProcNames{$ParentPID +} eq 'explorer.exe') { print 'Press ENTER to close the window: '; <>; } else{ print "..exiting normally\n"; }

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11116203]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-24 06:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found