batch-file - Windows批量获取参数延迟
问题描述
我写了一个批处理脚本来杀死进程,就是这样
@echo off
IF "%1" NEQ "" (
Set "process=%1.exe"
echo "killing process %process%"
taskkill /F /IM %process% /T
)
我把它命名为mkill.cmd
.
C:\Users\Administrator>mkill chrome
"killing process "
ERROR: Invalid syntax.
Type "TASKKILL /?" for usage.
C:\Users\Administrator>mkill chrome
"killing process chrome.exe"
SUCCESS: The process with PID 8892 (child process of PID 7732 ) has been terminated.
SUCCESS: The process with PID 4024 (child process of PID 7732 ) has been terminated.
C:\Users\Administrator>mkill telegram
"killing process chrome.exe"
Error: The process "chrome.exe" not found.
C:\Users\Administrator>mkill test
"killing process telegram.exe"
SUCCESS: The process with PID 2896 (child process of PID 3952 ) has been terminated.
参数传递似乎有延迟。有什么问题?
解决方案
推荐阅读
- node.js - 登录在本地主机中工作,但在 Heroku 中部署时出现“会话所需的秘密选项”错误
- javascript - 使用 javascript 计时将 Gif 链接到 Div
- oracle - 无法从 Oracle SQL Developer 建立与 AWS RDS Oracle 数据库实例的连接
- php - 不带like()的按字母排序的查询 - laravel | 调用未定义的方法 Illuminate\Database\Query\Builder::LIKE()
- reactjs - 在父组件中的事件之后更新子组件中的道具?
- postgresql - 为什么 docker-entrypoint-initdb.d 中的脚本在数据库开始侦听导致 pg_restore 失败的连接之前运行?
- sql - 选择案例中多个组中用户的所有列
- javascript - 通过链接 Ng-Select(s) 过滤数据
- python - 如何检查我的 python 脚本是否以某种方式运行(使用某种调试器)
- vue.js - 在 VueJS 中弹出搜索结果页面