需求:关闭所有CMD窗口
powershell试试这2句命令
cmd.exe /c "wmic process where name='cmd.exe' get executablepath,processid,threadcount"
cmd.exe /c "wmic process where name='conhost.exe' get executablepath,processid,threadcount"
cmd.exe /c "wmic process where name='cmd.exe' call terminate"
cmd.exe /c "wmic process where name='conhost.exe' call terminate"
或者试试这句命令
Get-Process cmd | Stop-Process
Get-Process conhost | Stop-Process
wmic命令很多,如果在powershell中用的话,cmd.exe /c "wmic命令",直接cmd命令行执行的话不用加cmd.exe /c
这里是我之前用过的一些wmic命令
wmic csproduct get UUID
wmic cpu get Name,NumberOfCores,NumberOfLogicalProcessors,MaxClockSpeed,ProcessorId
wmic useraccount get caption,sid
wmic useraccount get name,sid
wmic pagefile list /format:list
wmic process get ExecutablePath,ProcessId,Description,ParentProcessId,ReadOperationCount,WriteOperationCount,ThreadCount
wmic qfe list full /format:table
wmic qfe list full /format:htable > hotfixes.htm && hotfixes.htm
wmic qfe list brief
wmic qfe list
wmic qfe get HotFixID,InstalledOn,Description,Caption
最后提醒下,不是所有长得像cmd窗口的都是cmd.exe或conhost.exe,也有Console可执行文件。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。