【问题标题】:Can't copy .bat file into .exe file无法将 .bat 文件复制到 .exe 文件中
【发布时间】:2015-04-22 11:05:45
【问题描述】:

我正在尝试在子文件夹 ($_OUTDIR) 中创建包含批处理文件 (configure.bat) 的 .exe 文件,以便在运行 .exe 文件后再次执行它。 但是批处理文件没有来。

!ifdef INNER
....
  OutFile "${OUTPUT_DIR}\${SHORT_NAME}-${VERSION}-${RELEASE}.exe"
....
!endif

....
....
....

Section "Install" Install
....
    SetOutPath "$_OUTDIR"
    File ${TLM_DIR}\*
    ExecWait '"$_OUTDIR\configure.bat"'
....
SectionEnd

你能帮我做这件事吗?

【问题讨论】:

  • 你为什么使用 $_OUTDIR?请不要使用未记录的内部变量...
  • 因为在执行文件 (Project_name.exe) 中包括.. - 文件夹 $COMMONFILES - 文件夹 $PLUGSINTDIR - 文件夹 $TEMP - 文件夹 $_OUTDIR - 文件夹 doc - 其他文件,我需要复制配置。 bat 到 $_OUTDIR 路径。
  • 你说的是反编译安装程序吗?我知道如果你这样做,你会找到 $_OutDir 但就像我说的那样,它是无证的,不应该使用。即使不是,您在 SetOutPath 中使用它的方式也是错误的......

标签: batch-file installation exe nsis


【解决方案1】:

$_OUTDIR 是一个内部未记录的 NSIS 变量! SetOutPath 设置的变量是$OUTDIR 但输入应该是别的东西。

Section
InitPluginsDir
SetOutPath $PluginsDir
File MyStuff\*
ExecWait '"$OutDir\config.bat"'
SetOutPath $Temp ; Don't lock the plugin folder so it can be deleted
SectionEnd

您通常不会在任何地方使用$OutDir,只需使用 $InstDir...

【讨论】:

    猜你喜欢
    • 2012-01-26
    • 1970-01-01
    • 2018-05-26
    • 2014-03-23
    • 2020-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-04
    相关资源
    最近更新 更多