wmic

此工具有很多功能

查看进程的运行参数

wmic process where caption="chrome.exe"

wmic process where(description="mysqld.exe") >> mysql.log
#查询MySQL的路径输出到MySQL.log文件

wmic process where(description="cmd.exe")
#查询cmd的路径并立即输出

wmic service where caption="zhudongfangyu" call stopservice
wmic service where name="zhudongfangyu" call stopservice
echo y|wmic process where processid=6428 call terminate  干掉pid
echo y|wmic process where name="SogouExplorer.exe" call terminate 干掉进程

wmic process get description,executablepath
#获取进程路径

wmic product get name,versionwmic product list brief
#查看安装的软件

查看CPU信息

wmic cpu get

NumberOfCores:表示CPU核心数

NumberOfLogicalProcessors:表示CPU逻辑核数。当有超线程时,比如2,逻辑核数=核心数*2

使用 systeminfo 也可查看

服务运行winsw

示例配置:

<?xml version="1.0" encoding="UTF-8"?>
<service>
    <id>Nginx</id>
    <name>Nginx</name>
    <description>nginx</description>
    <logpath>D:\nginx\logs</logpath>
    <executable>nginx.exe</executable>
    <stopexecutable>nginx.exe</stopexecutable>
    <stopargument>-s</stopargument>
    <stopargument>stop</stopargument>
    <logmode>rotate</logmode>
</service>

脚本:设置ip与连接wifi

netsh interface ipv4 set address name="无线网络连接" source=static addr=192.168.108.165 mask=255.255.255.0 gateway=192.168.108.1
netsh wlan connect ssid=langchao_1 name=langchao_1