返回列表 发帖

[其他] 代码分享:bat转exe后接收参数

本帖最后由 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
pauseCOPY
第二种是用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
pauseCOPY
1

评分人数

    • yu2n: 感谢分享技术 + 1

返回列表