windows to view the PID and kill the process according to port

1. First, use netstat -ano | find "port number" find out the process ID

Obviously there is the port number 17568 and 18892, to determine how it is 17568

2. takslist query the current conduct

 

3. How to kill the process it tasklist / pid $ {xx}

Found not do it, enough authority, with administrator privileges to run cmd, and discovered the error, and said to be enforceable only, plus -F

 

Summarized below:

taskkill is a Windows command line terminates the specified procedure "process" command.

/ f represents the forced termination
/ im represents the specified process name, such as "explor.exe"

/ Pid indicates that the specified process ID process ID

taskkill /f /im javaw.exe
taskkill /f /pid 3352

 

?
1
2
3
4
5
6
7
8
9
10
11
总结下:
 
taskkill是Windows命令行里终止指定程序“进程”的命令。
 
/f 表示强制终止
/im 表示指定的进程名称,例如“explor.exe"
 
/pid 表示指定的进程ID进程号
 
taskkill /f /im javaw.exe
taskkill /f /pid 3352

 

windows batch delete the specified process

?
1
2
3
4
5
6
7
8
9
10
11
12
13
@ echo off
setlocal enabledelayedexpansion
set /p port=请输入端口号:
for /f "tokens=1-5" %%a in ( 'netstat -ano ^| find ":%port%"' ) do (
     if "%%e%" == "" (
         set pid=%%d
     ) else (
         set pid=%%e
     )
     echo !pid!
     taskkill /f /pid !pid!
)
pause

  One of the above

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
@ echo off & color 3d & setlocal enabledelayedexpansion
   ::ipconfig>ip.txt
  
   
netstat -aon |findstr 8083>pid.txt
      
      for /f "delims=" %%a in (pid.txt) do (
         
       for /f "tokens=1* delims=:" %%i in ( 'call echo %%a^|find /i "TCP"' ) do (
          echo %%a
      ::读取出内容过滤后,写入另一个记事本中
      rem Echo %%a>> "text.txt"
        
     )
rem 读取文件中内容
set /P OEM=<pid.txt
  
rem 截取文件中的字符串
  
echo  %OEM:~71,76%
  
taskkill /f /pid %OEM:~71,76%

  

原文地址:https://www.cnblogs.com/qianjinyan/p/10772540.html 

1. 首先用netstat -ano | find “端口号”查出进程号

明明有端口号是17568和18892, 如何确定是17568呢

2. takslist 查询当前的进行

 

3. 如何杀死进程呢  tasklist /pid ${xx}

发现不行呢,权限不够,用管理员权限运行cmd,发现又报错了,说要强制执行才可以,加上-F

 

总结下:

taskkill是Windows命令行里终止指定程序“进程”的命令。

/f 表示强制终止
/im 表示指定的进程名称,例如“explor.exe"

/pid 表示指定的进程ID进程号

taskkill /f /im javaw.exe
taskkill /f /pid 3352

 

?
1
2
3
4
5
6
7
8
9
10
11
总结下:
 
taskkill是Windows命令行里终止指定程序“进程”的命令。
 
/f 表示强制终止
/im 表示指定的进程名称,例如“explor.exe"
 
/pid 表示指定的进程ID进程号
 
taskkill /f /im javaw.exe
taskkill /f /pid 3352

 

windows批处理删除指定进程

?
1
2
3
4
5
6
7
8
9
10
11
12
13
@ echo off
setlocal enabledelayedexpansion
set /p port=请输入端口号:
for /f "tokens=1-5" %%a in ( 'netstat -ano ^| find ":%port%"' ) do (
     if "%%e%" == "" (
         set pid=%%d
     ) else (
         set pid=%%e
     )
     echo !pid!
     taskkill /f /pid !pid!
)
pause

  上面一种

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
@ echo off & color 3d & setlocal enabledelayedexpansion
   ::ipconfig>ip.txt
  
   
netstat -aon |findstr 8083>pid.txt
      
      for /f "delims=" %%a in (pid.txt) do (
         
       for /f "tokens=1* delims=:" %%i in ( 'call echo %%a^|find /i "TCP"' ) do (
          echo %%a
      ::读取出内容过滤后,写入另一个记事本中
      rem Echo %%a>> "text.txt"
        
     )
rem 读取文件中内容
set /P OEM=<pid.txt
  
rem 截取文件中的字符串
  
echo  %OEM:~71,76%
  
taskkill /f /pid %OEM:~71,76%

  

原文地址:https://www.cnblogs.com/qianjinyan/p/10772540.html 

Guess you like

Origin www.cnblogs.com/jpfss/p/12001238.html