windows – 批处理文件提取字符串部分
发布时间:2020-12-14 05:24:57 所属栏目:Windows 来源:网络整理
导读:我有这个窗口的批处理命令: wmic process call create "notepad.exe" | find "ProcessId" 它返回此字符串 (spaces) ProcessId = 13764; 而且我只需要在变量中存储pid号(13764),我该怎么办? 解决方法 for /F "delims=" %%a in ('wmic process call create "
我有这个窗口的批处理命令:
wmic process call create "notepad.exe" | find "ProcessId" 它返回此字符串 (spaces) ProcessId = 13764; 而且我只需要在变量中存储pid号(13764),我该怎么办? 解决方法for /F "delims=" %%a in ('wmic process call create "notepad.exe" ^| find "ProcessId"') do ( for %%b in (%%a) do set value=%%b ) echo %value% 此方法返回行中的最后一个单词,因此它也可以在开头的可变数量的单词的其他行中使用. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- windows – Jenkins:运行远程测试脚本和报告结果
- windows-server-2003 – 在哪里可以查看活动目录
- 如何查看Windows机器上是否正在使用端口?
- windows-runtime – 如何在C/C++X中迭代IIterabl
- windows-server-2012-r2 – 使用netsh.exe的Wind
- windows – 有没有办法延迟强制重启?
- Windows – WMI问题 – 页面文件太小,无法完成此
- 缺少.NET Dispatcher类(System.Windows.Threadin
- windows-7 – 如何从命令行或系统调用打开“性能
- Windows – Server 2008 R2上的远程服务器管理工
热点阅读