NSIS 安装程序错误 - 没有足够的内存资源来处理此命令
我使用 NSIS 包创建了一个安装程序来安装我自己的软件以及一些第三方软件,例如 Notepad++ 和 winPython。正在运行批处理脚本来安装 notepad++ 和 winPython。打包到安装程序中的 winPython 的压缩格式为“winPython3940.7z”。使用以下 .nsh
脚本将其作为安装程序的一部分解压缩到文件夹中。
; --------------------------------------------------------------------------------------------
; Install Third Party Software
; --------------------------------------------------------------------------------------------
Section "Install Third Party Software"
; Execute Notepad++ installer
${If} $Notepad_userDecision == "1"
DetailPrint ""
DetailPrint "----------------- Install Notepad++ -----------------"
DetailPrint ""
DetailPrint "Create Notepad++ install batch..."
${textreplace::ReplaceInFile} "${TEMP_PATH}installer_template.bat" "${TEMP_PATH}install_notepad.bat" "#INSTALL_CMD" '"${TEMP_PATH}Notepad\npp.7.8.7.Installer.x64.exe" /S' "/S=1 /C=1 /AO=1 /PI=0 /PO=0" $0
DetailPrint "Execute Notepad++ install batch..."
nsExec::Exec "${TEMP_PATH}install_notepad.bat"
${EndIf}
; --------> PROBLEMATIC PART: Execute WinPython installer
${If} $WinPython_userDecision == "1"
; Delete old winPython Installation
DetailPrint ""
DetailPrint "----------------- Delete old WinPython installation -----------------"
DetailPrint ""
DetailPrint "Create WinPython uninstall batch..."
${textreplace::ReplaceInFile} "${TEMP_PATH}installer_template.bat" "${TEMP_PATH}uninstall_winpython.bat" "#INSTALL_CMD" 'if exist ("${PYTHON_PATH}" rmdir /s /q "${PYTHON_PATH}")' "/S=1 /C=1 /AO=1 /PI=0 /PO=0" $0
DetailPrint "Execute WinPython uninstall batch..."
nsExec::Exec "${TEMP_PATH}uninstall_winpython.bat"
DetailPrint ""
DetailPrint "----------------- Install WinPython -----------------"
DetailPrint ""
DetailPrint "Create WinPython install batch..."
${textreplace::ReplaceInFile} "${TEMP_PATH}installer_template.bat" "${TEMP_PATH}install_winPython.bat" "#INSTALL_CMD" 'if exist "C:\Program Files\7-Zip\7z.exe" ("C:\Program Files\7-Zip\7z.exe" x "${TEMP_PATH}WinPython\winPython3940.7z" -o${PYTHON_PATH})' "/S=1 /C=1 /AO=1 /PI=0 /PO=0" $0
DetailPrint "Execute WinPython install batch..."
nsExec::Exec "${TEMP_PATH}install_winPython.bat"
${EndIf}
SectionEnd
Notepad++ 和 winPython 都可以完美安装(没有任何弹出的 cmd 窗口),但前者有一些软错误。正在运行 2 个批处理脚本来删除旧的 winPython 安装,然后安装新的。当安装程序运行时,这两个脚本都会打开 2 个单独的 cmd 窗口,其中第二个窗口在第一个窗口关闭后打开。脚本完美执行,但它们都包含“没有足够的内存资源可用于处理此命令” winPython 卸载程序脚本的 cmd 窗口 和 winPython 安装程序脚本的 cmd 窗口。
我该如何解决这个问题?
I have created an installer using NSIS package to install my own software along with some 3rd party softwares such as Notepad++ and winPython. Batch scripts are being run to install notepad++ and winPython. The winPython which is packaged into the installer is in a zipped format "winPython3940.7z". This is being unzipped into a folder as a part of the installer using the following .nsh
script.
; --------------------------------------------------------------------------------------------
; Install Third Party Software
; --------------------------------------------------------------------------------------------
Section "Install Third Party Software"
; Execute Notepad++ installer
${If} $Notepad_userDecision == "1"
DetailPrint ""
DetailPrint "----------------- Install Notepad++ -----------------"
DetailPrint ""
DetailPrint "Create Notepad++ install batch..."
${textreplace::ReplaceInFile} "${TEMP_PATH}installer_template.bat" "${TEMP_PATH}install_notepad.bat" "#INSTALL_CMD" '"${TEMP_PATH}Notepad\npp.7.8.7.Installer.x64.exe" /S' "/S=1 /C=1 /AO=1 /PI=0 /PO=0" $0
DetailPrint "Execute Notepad++ install batch..."
nsExec::Exec "${TEMP_PATH}install_notepad.bat"
${EndIf}
; --------> PROBLEMATIC PART: Execute WinPython installer
${If} $WinPython_userDecision == "1"
; Delete old winPython Installation
DetailPrint ""
DetailPrint "----------------- Delete old WinPython installation -----------------"
DetailPrint ""
DetailPrint "Create WinPython uninstall batch..."
${textreplace::ReplaceInFile} "${TEMP_PATH}installer_template.bat" "${TEMP_PATH}uninstall_winpython.bat" "#INSTALL_CMD" 'if exist ("${PYTHON_PATH}" rmdir /s /q "${PYTHON_PATH}")' "/S=1 /C=1 /AO=1 /PI=0 /PO=0" $0
DetailPrint "Execute WinPython uninstall batch..."
nsExec::Exec "${TEMP_PATH}uninstall_winpython.bat"
DetailPrint ""
DetailPrint "----------------- Install WinPython -----------------"
DetailPrint ""
DetailPrint "Create WinPython install batch..."
${textreplace::ReplaceInFile} "${TEMP_PATH}installer_template.bat" "${TEMP_PATH}install_winPython.bat" "#INSTALL_CMD" 'if exist "C:\Program Files\7-Zip\7z.exe" ("C:\Program Files\7-Zip\7z.exe" x "${TEMP_PATH}WinPython\winPython3940.7z" -o${PYTHON_PATH})' "/S=1 /C=1 /AO=1 /PI=0 /PO=0" $0
DetailPrint "Execute WinPython install batch..."
nsExec::Exec "${TEMP_PATH}install_winPython.bat"
${EndIf}
SectionEnd
Notepad++ gets installed perfectly (without any popup cmd windows) as well as winPython, but the former has a couple of soft bugs. 2 batch scripts are being run to delete an old winPython installation and then installation the new one. When the installer is running, both of these scripts open up 2 individual cmd windows where the second one opens up after the first one is closed. Scripts get executed perfectly but they both contain "Not enough memory resources available to process this command"
winPython uninstaller script's cmd window and winPython installer script's cmd window.
How do I resolve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该消息不是来自 NSIS,它一定来自批处理文件中的某些内容,也许是 7-Zip。
没有理由使用批处理文件来删除某些内容,只需使用 NSIS:
您也可以尝试 这个 7z 插件-in 而不是调用 7z-exe。
That message is not coming from NSIS, it must be from something inside your batch file, perhaps 7-Zip.
There is no reason to use a batch file to delete something, just use NSIS:
You could also try this 7z plug-in instead of calling 7z-exe.