Getting IExpress to install to copy files to right location

8.1k Views Asked by At

I'm trying to have an IExpress EXE that copies some files to a directory in "Program Files" but I'm struggling to get it to work. So far I have one File I want to copy, and the one .bat file in the EXE. I know that IExpress EXE's extract their contents to %\temp%\IXP000.TMP so I thought that I could easily copy the file to the Program Files folder by having the following in the .bat file:

mkdir C:\"Program Files"\HybRIDS
C:\Windows\System32\xcopy %temp%\IXP000.TMP C:\"Program Files"\HybRIDS /i

But when I run the EXE and take a look there's nothing in my Program Files.

What am I doing wrong?

3

There are 3 best solutions below

1
On

I know that IExpress EXE's extract their contents to %\temp%\IXP000.TMP

Is not true. It extracts to a sub folder of temp.

mkdir "%ProgramFiles%\HybRIDS"
copy "%~dp0\IXP000.TMP" "%ProgramFiles%\HybRIDS"

Put a pause at end of batch file. It will remain in temp to check the sub folder (mine is 1), plus you'll see any error messages. Make sure Echo is Off.

0
On

This isn’t a very complete answer (unlike owns’s). But most errors I’ve seen with IExpress and batch files are caused by people calling them directly, rather than via cmd.exe.

Make sure you’re running it like:

cmd /c mybatch.bat
0
On

There's no need to refer the the temp folder directly; just assume the current working directory:

@echo off
rem install.bat
mkdir %ProgramFiles%\HybRIDS
echo %ERRORLEVEL% created directory %ProgramFiles%\HybRIDS
copy * C:\"Program Files"\HybRIDS
echo %ERRORLEVEL% copied files
del C:\"Program Files"\HybRIDS\install.bat
echo %ERRORLEVEL% success?

When you configure the sed for testing, make sure to maximize the installation ShowInstallProgramWindow=3 and correctly set the installation script AppLaunched=cmd /c install.bat. Also add the pause statement at the end of the batch script like BambiLongGone suggested for testing. I used the follow format for error handling (assuming the installation window is hidden ShowInstallProgramWindow=1)

@echo off
REM install.bat    
mkdir %ProgramFiles%\HybRIDS 
REM mkdir may fail because the folder already exists - ignore errors.    

move * %ProgramFiles%\HybRIDS > temp.txt 2>&1
set i=%ERRORLEVEL%
REM check for errors!
if not %i%==0 (
    REM inform the user with a prompt (will not wait for it to close though...)
    start cmd /c^
        echo error occured during installation^
&       type temp.txt^
&       echo what to do next...^
&       pause
)
REM don't keep the install and temp.txt file
del %ProgramFiles%\install.bat
del %ProgramFiles%\temp.txt

If you have any questions just let me know.