本帖最后由 522235677 于 2016-3-8 16:28 编辑
正常情况下,当bat转exe后,给exe参数,但是exe程序并不会把参数再次传递给批处理文件。
此代码就是为了解决这个问题,不知前辈们有没有发过类似的帖子。
两种情况下的代码,第一种是用bat转exe工具- @echo off & title zf
- for /f tokens^=3^delims^="" %%a in ('tasklist /v /fo csv^|find "zf"') do (
- for /f "skip=1 delims=" %%b in ('wmic process where handle^=%%a get commandline^|findstr "."') do call :start %%b
- )
- exit
-
- :start
- shift
- echo %1 %2
- pause
复制代码 第二种是用winrar自解压文件- @echo off & title zf
- for /f tokens^=3^delims^="" %%a in ('tasklist /v /fo csv^|find "zf"') do (
- for /f "skip=1" %%b in ('wmic process where handle^="%%a" get ParentProcessId^|findstr "."') do (
- for /f "skip=1 delims=" %%c in ('wmic process where handle^=%%b get commandline^|findstr "."') do call :start %%c
- )
- )
- exit
-
- :start
- shift
- echo %1 %2
- pause
复制代码
|