Using DOS command to get Explorer.exe's PID detailed

Source: Internet
Author: User

Just show up:

The code is as follows Copy Code
::===============
@echo off
WMIC process where name= "explorer.exe" Get Handle
Pause
::===============

Pass to Variable:

The code is as follows Copy Code
::===============
@echo off
for/f "Skip=1"%%i in (the ' WMIC process where ' name= ' explorer.exe ' "Get Handle ') do (
Echo%%i)
Pause
::===============

WMIC process where name= "explorer.exe" Get Handle

is a WMIC query statement:

WMIC is a command-line management system that is brought up by Windows systems to manage systems that can be specifically helped by:
Open cmd, and then enter WMIC/?

Process is a class in WMIC that contains management of system processes.

Where is the WMIC conditional statement,

Get handle is the statement that gets the PID.

The

Skip=1 is a parameter under the batch for loop/F command, with a simple few words to explain the batch for/f command, if you want to learn, you have to spend Kung fu learning.
Suggestions: Want to learn batch processing can not rely solely on the individual command, the system of learning, mastered the method of natural simple, recommended to the batch of home and other professional batch processing forum or Web site System learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.