'NSIS Installer error - Not enough memory resources available to process this command

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?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source