回复 2# flashercs
看了之后才感觉原来这么简单,陷入思维误区了,一直在想着怎么用 delims 和 tokens 达成期望的效果,居然把 for %variable in (set) do command 给忘了- @echo off
- set Key1=HKCU\Software\Microsoft\Windows\CurrentVersion\Run
- set Key2=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
- set Key3=HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run
- call :GetInfo
- echo 名称:%FileName%
- echo 路径:%FilePath%
- taskkill /f /im %FileName% >nul 2>nul
- pause & exit
- :GetInfo
- for %%i in (%Key1% %Key2% %Key3%) do (
- for /f "tokens=2*" %%j in ('reg query "%%i" /v "ABC" 2^>nul') do (
- for %%l in (%%k) do (
- if %%l EQU 1 goto :eof
- set FilePath=%%~l
- set FileName=%%~nxl
- )
- )
- )
复制代码
|