2026-05-06 11:57AM
1. 启动进程
$ Start-Process node "启动文件" -WindowStyle Hidden
例如:
$ Start-Process node ".\index.js --yesterday" -WindowStyle Hidden
2. 查看是否正在运行
$ Get-CimInstance Win32_Process -Filter "Name='node.exe'" | Select-Object ProcessId, CommandLine
例如:
$ Get-CimInstance Win32_Process -Filter "Name='node.exe'" | Select-Object ProcessId, CommandLine
ProcessId CommandLine
--------- -----------
9100 "C:\Program Files\nodejs\node.exe" .\index.js --yesterday
3. 停止进程
$ Stop-Process -Id xxxx -Force
例如:
$ Stop-Process -Id 9100 -Force
使用万能停止命令,一键停止所有 index.js 进程
$ Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like "*index.js*" } | Stop-Process -Force
登录
请登录后再发表评论。
评论列表:
目前还没有人发表评论