Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Windows 10 Command Prompt

by NetWallah (Canon)
on Apr 28, 2020 at 20:29 UTC ( [id://11116170]=note: print w/replies, xml ) Need Help??


in reply to Windows 10 Command Prompt

This is crude and brutal, but it works for me:
perl -e "for (qx[wmic process get processid,parentprocessid,executable +path ]){next unless m/perl.+\Q$$\E/;$parent=(split /\s+/,$_) [1] ;qx| +taskkill /PID $parent|} "
It kills the command prompt where this code is called from.

                "Imaginary friends are a sign of a mental disorder if they cause distress, including antisocial behavior. Religion frequently meets that description"

Replies are listed 'Best First'.
Re^2: Windows 10 Command Prompt
by bliako (Monsignor) on Apr 29, 2020 at 12:31 UTC

    why not just Win32::Getppid (oops thanks soonix!)?

    use Win32::Getppid; my $parent_pid = getppid;

    bw, bliako

    edit: primitive os, brutal practices :)

      @bliako: Thanks this worked to get the process ID!

Re^2: Windows 10 Command Prompt
by PilotinControl (Pilgrim) on Dec 24, 2020 at 21:33 UTC

    @NetWallah: yes and it does work as expected.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-04-19 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found