1.

Solve : Batch file installer fail to launch program at the end of script...?

Answer»

I am having a problem with a batch file that does this:

1. Checks to see if folder1 exists; if not, then it makes it
2. Checks to see if sub-folder1 exists; if not, then it makes it
3. Copies a file to the sub-folder1
4. Copies 3 files to the folder1
5. Deletes the above 4 files from the current directory
6. Runs a Vb-script that extracts the Zip-file to the FOLDER %APPDATA%
7. Deletes the Zip-file and Vb-script from folder1
8. Runs the file (File Launcher.exe) in the folder1 <--This is where the script GOES wrong...

It shows it run for a really short time (as in I can see it display the proper text in the command window) and closes without functioning properly
When I normally run the File Launcher.exe, it works fine. In the installer script, it does not work right.

Installer script:    (Could this being "compiled" be the problem?)
Code: [Select]ECHO OFF
TITLE File Installer [By: Nathansswell]
COLOR 0A
SET PATH=%USERPROFILE%\My Documents\Folder
SET PATH2=%USERPROFILE%\My Documents\Folder\Subfolder
ECHO ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
IF EXIST "%PATH%" GOTO A
IF NOT EXIST "%PATH%" MKDIR "%PATH%"
ECHO º Creating folder "Folder"    º
:A
IF EXIST "%PATH2%" GOTO B
IF NOT EXIST "%PATH2%" MKDIR "%PATH2%"
ECHO ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
ECHO º Creating folder "Subfolder" º
ECHO ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
:B
ECHO º       Moving items to       º
ECHO º   "My Documents\Folder"     º
ECHO ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
:1
COPY "file.exe" "%PATH2%" >nul
IF EXIST "%PATH2%\file.exe" GOTO 2
IF NOT EXIST "%PATH2%\file.exe" GOTO 1
:2
COPY "File Launcher.exe" "%PATH%" >nul
IF EXIST "%PATH%\File Launcher.exe" GOTO 3
IF NOT EXIST "%PATH%\File Launcher.exe" GOTO 2
:3
COPY "ZIPFILE.zip" "%PATH%" >nul
IF EXIST "%PATH%\Zipfile.zip" GOTO 4
IF NOT EXIST "%PATH%\Zipfile.zip" GOTO 3
:4
COPY "extractor.vbs" "%PATH%" >nul
IF EXIST "%PATH%\extractor.vbs" GOTO 5
IF NOT EXIST "%PATH%\extractor.vbs" GOTO 4
:5
DEL "File Launcher.exe"
DEL "Zipfile.zip"
DEL "extractor.vbs"
ECHO º   Running "extractor.vbs"   º
ECHO ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
"%PATH%\extractor.vbs"
CLS
DEL "%PATH%\extractor.vbs"
DEL "%PATH%\.Zipfile.zip"
START "%PATH%\File Launcher.exe"
EXITFile Launcher.exe script:      (It is a "compiled" batch file that works fine)
Code: [Select]ECHO OFF
MODE CON COLS=30 LINES=12
TITLE File Launcher
COLOR 0A
ATTRIB "Jarfile.jar" +H
ATTRIB "Splashx32.png" +H
ECHO ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
ECHO º Launching File...         º
ECHO ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
ECHO º Please wait...            º
ECHO ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
ECHO º WARNING:DO NOT CLOSE THIS º
ECHO ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
JAVA -Xmx1024M -Xms512M -splash:"Splashx32.png" -jar Jarfile.jar
ATTRIB "Jarfile.jar" -H
ATTRIB "Splashx32.png" -H
DEL "Jarfile.jar"
DEL "Splashx32.png"
EXITVb-script:     (This also works fine)
Code: [Select]path=Replace(WScript.ScriptFullName, WScript.ScriptName, "")
path2="%APPDATA%"
path3="Zipfile.zip"
Set ws=CreateObject("WScript.Shell")
fullpath=ws.ExpandEnvironmentStrings(path)
fullpath2=ws.ExpandEnvironmentStrings(path2)
ZipFile=fullpath&path3
ExtractTo=fullpath2
Set fso = CreateObject("Scripting.FileSystemObject")
If NOT fso.FolderExists(ExtractTo) Then
fso.CreateFolder(ExtractTo)
End If
set objShell = CreateObject("Shell.Application")
set FilesInZip=objShell.NameSpace(ZipFile).items
objShell.NameSpace(ExtractTo).CopyHere(FilesInZip)
Set fso = Nothing
Set objShell = Nothing
Thanks in ADVANCE. -Nathansswell



Discussion

No Comment Found