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 (Abbot) 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.