Hi and apologies for using English on the board. (You can of course answer in Russian - appreciate it!)
My archive is a directory with files (MyDir), and the executable I want to run is inside it (MyProg.exe).
This is the basic configure file:
;!@Install@!UTF-8!
RunProgram="\"MyDir\\MyProg.exe\""
GUIMode="1"
;!@InstallEnd@!
The problem is that my .exe has dependencies and has to be run from its own folder, or these dependencies fail. (It loads plugins which are expected in the current dir, but can't find them because the current running folder is the dir containing MyDir).
My first idea was to use Directory but docs say:
"
Directory: Путь к папке команды исполнения 'RunProgram' (не путать с текущей папкой).
RunProgram="notepad.exe"
Directory="C:\\Windows\\system32\\"
равнозначны
RunProgram="C:\\Windows\\system32\\notepad.exe"
"
- so it's actually not helping me to define the "current directory".
My other solution was to change the RunProgram parameter to run a batch file: RunProgram="\"MyDir\\run.bat\"" and have this inside it:
"
cd MyDir
MyProg.exe
exit
"
The program runs, but I get a console window. If I use hidcon - there is no console window but also no program window for MyProg.exe.
Hi spectat0r, thank you for your suggestion. You led me to the right solution.
What I eventually did:
RunProgram="hidcon:\"MyDir\\run.bat\""
and in run.bat:
start /w /d "MyDir" MyProg.exe
exit
When I tried your suggestion of cmd.exe /c (closing the console immediately) then not all of the files in my archive were extracted! To confirm - as soon as I got the message box error about the missing .dlls I went to the Temp folder and saw what is in the archive. If I did /c then some of my .dlls are not there. I then tried cmd /k - and all files were there.
I don't know why this happens - but looks like the .bat file option (running in a hidden window, opening a new window for the program I actually want to see) works ok for me.
Гуру, помогите разделить архитектуры x86 и AMD64 с модифицированным модулем.
Моя задача: выполнять батник с учётом различий в архитектуре, т.к. батник использует, например, dism.exe, который, будучи запущенный в 32-битной консоли на 64-битной системе, отказывается работать.
Батник содержит строку DISM.exe /online /cleanup-image /spsuperseded /hidesp
Конфиг config.txt:
;!@Install@!UTF-8:x86!
Title="Kindred server system disk cleanup tool 2.0"
RunProgram="cleanup2.cmd"
;!@InstallEnd@:x86!
;!@Install@!UTF-8:x64!
Title="Kindred server system disk cleanup tool 2.0"
RunProgram="cleanup2.cmd"
;!@InstallEnd@:x64!
Проблема в том, что вне зависимости от указания платформенных секций, батник выполняется в среде архитектуры, которая использовалась для разархивирования. Если использовался модуль разархивации 32-битный (copy /b 7zsd_lzma.sfx+config.txt+cleanup2.7z cleanup2.exe), то и батник выполняется в 32-битной командной консоли, если модуль разархивации 64-битный (copy /b 7zsd_lzma_x64.sfx+config.txt+cleanup2.7z cleanup2.exe), то батник выполняется в 64-битной консоли, что ОК на 64-битных системах, но при этом на 32-битных системах экзешник не запускается вообще. Если же при сборке затолкать модули разархивации как для 32-битных так и для 64-битных систем, то получившийся SFX просто использует первый затолканный модуль и я опять сталкиваюсь с тем, что мой скрипт выполняется либо на всех ОС, но в 32-битной консоли, либо в 64-битной консоли на 64-битных системах, а на 32-битных не запускается вообще.
Кто виноват и что делать? Как сделать так, чтобы командная консоль соответствовала битности архитектуры, на которой запустился SFX?