Batch File Help Needed


Rbcc

Member
Local time
10:58 AM
Posts
22
OS
Windows 11 pro
I am Using WinRar to create a self extracting install Program to Install a Pro and some dll helper file to make it run.
The file is named afile.exe with /s /d=Where I want it installed and helper1.dll and helper2.dll.
in my program.cmd "batch file" I Have:
a.file /s /d="T:\Temp"
copy helper1.dll, t:\temp
copy helper2.dll,t:\temp

in the winrar sfx options I have
tempmode=1
overwrite=1
run file after extraction a.file

do I have to put the directory where the files came from if all the files are packaged in the exe file such as C:\temp\a.file?
How would I get this to work if I am running it through the adk?

John
 

My Computer

System One

  • OS
    Windows 11 pro
    Computer type
    Laptop
    Manufacturer/Model
    Asus
    CPU
    I-7 2gigaherz
    Motherboard
    Asus
    Memory
    16Gig
    Screen Resolution
    1024x768
    Hard Drives
    512 SSD
I am Using WinRar to create a self extracting install Program to Install a Pro and some dll helper file to make it run.
The file is named afile.exe with /s /d=Where I want it installed and helper1.dll and helper2.dll.
in my program.cmd "batch file" I Have:
a.file /s /d="T:\Temp"

You seem to be using two different file names. The correct line may be

afile.exe /s /d="T:\Temp"

copy helper1.dll, t:\temp
copy helper2.dll,t:\temp

You might try removing the comma in the first line and replacing the comma with a space in the second.

in the winrar sfx options I have
tempmode=1
overwrite=1
run file after extraction a.file

do I have to put the directory where the files came from if all the files are packaged in the exe file such as C:\temp\a.file?
How would I get this to work if I am running it through the adk?

John

Ben
 

My Computer

System One

  • OS
    Windows 10 Home
    Computer type
    Laptop
    Manufacturer/Model
    HP Elitebook 2530p
    CPU
    Intel Core 2 Duo L9400@1.86 GHz
    Memory
    2 GB
Ben,

Should I change :

copy helper1.dll, t:\temp
copy helper2.dll,t:\temp

To:

copy helper1.dll t:\temp
copy helper2.dll t:\temp

And If Tempmode is checked in WinRar sfx[AnFile.exe] as in PIc1 belowScreen1.webp
If the three files are packaged in the sfx, .exe file, a.file ,helper1 and helper 2 files? Also the afile.cmd should this batch file work?

batch file a.file.cmd contents:
START a.file /S /D="T:\TEMP
copy helper1.dll T:\TEMP
copy helper2.dll T:\TEMP

Ben,
Thank you , John
 

My Computer

System One

  • OS
    Windows 11 pro
    Computer type
    Laptop
    Manufacturer/Model
    Asus
    CPU
    I-7 2gigaherz
    Motherboard
    Asus
    Memory
    16Gig
    Screen Resolution
    1024x768
    Hard Drives
    512 SSD
I don't know much about WinRar, so I can't help you there. The copy lines look correct and should work. Please make sure that you get the file name correct in the first line. "File" is a very unusual extension and filenames with two periods are not commonly used. If it doesn't work, try removing the period. Also, technically there should be a close quotes at the end of the first line.

Ben
 

My Computer

System One

  • OS
    Windows 10 Home
    Computer type
    Laptop
    Manufacturer/Model
    HP Elitebook 2530p
    CPU
    Intel Core 2 Duo L9400@1.86 GHz
    Memory
    2 GB
This question isn't explained well, because the shared details are confusing.
Normally, a SFX archive is created to automate the install process. Anyone can unzip an archive file, but the point is to run a setup script or app so the user doesn't need to understand (or do) anything.

1. I presume a.file.exe/anfile.exe (you're not using the same filename in different sentences) is a SFX archive. Because you're invoking it with /S (silent) /D="path" to extract.

2. If your SFX extracts to a specific path "T:\TEMP", then why do you need to copy two external DLL's into the target folder? Should these two DLL files be part of the original archive? Are those local files specific to whatever Windows version you're running?

3. The CMD script copies helper1.dll & helper2.dll without being careful about the source directory path.

4. Using the Tempmode setting, WinRAR stages the files to the user's %TMP% folder. If the DLL's are in the staging folder, you should reference them by "%TMP%\helper1.dll".

5. If your shell wrapper script is running, the current path of where the script starts from is provided as "%~dp0". Do you need to use "%~dp0\helper.1dll" as the path?

6. Is the original a.file or whatever itself a SFX archive? Are you putting a SFX inside another SFX? Otherwise why is the SFX's own command is to call the same file again?


Maybe you should start over with a simple problem description. What is the type of program you're trying to install? Is it a portable app, where all you need is to copy program files around to a target folder? Does the app have its own installer which sets up folders, config files, and reg settings? Are the DLL's always in the same source location, because just copying a file without a clear path is not always reliable.
 

My Computer

System One

  • OS
    Windows 7
I am trying to use a batch file to create a silent install using WinRAR and sfx to create a self-extracting exe file. The end result will be run from RunAsyncronus in the adk . This will copy 3 files to the temporary directory (T:\Temp). Using a batch file and then running the silent switches that the programs use to administer the silent install to install program silent[redundant] .

Using the file: Chickenbone.exe with switches /d for the "directory to install to"[i.e. A:\chicken] and /s for silent and copy the files: Soupbone.dll and Hambone.dll into [A:\chicken] also. Therefore, they all go from [T:\temp] to [A:\chicken]. the lines in batch file [i.e. stuff.cmd] will be in chickenbone.exe. This will be made with Winrar. Now the question what are lines of code in the batch file, so that this executes properly??
 

My Computer

System One

  • OS
    Windows 11 pro
    Computer type
    Laptop
    Manufacturer/Model
    Asus
    CPU
    I-7 2gigaherz
    Motherboard
    Asus
    Memory
    16Gig
    Screen Resolution
    1024x768
    Hard Drives
    512 SSD
I'll presume you're doing an unattended Windows install, based on your previous postings.

You have a RunSynchronousCommand which copies 3 files to T:\Temp:
Code:
T:\Temp\Chickenbone.exe
T:\Temp\Soupbone.dll
T:\Temp\Hambone.dll

1. Because you know the SFX's destination folder and provided it on the command line, using:
Code:
T:\Temp\Chickenbone.exe /s /d"A:\Chicken"
the Tempmode setting is not applicable.

Tempmode is normally used to stage the install, by first extracting to a temp folder before having the installer ask where the user wants to install (copy files). Since you already know the destination, the SFX can be extracted directly without an intermediate step.

2. To make your install script portable, we need to know the installed path. Fortunately, when the SFX extracts to a folder and calls your install script, it always changes directory (does a "cd") to that folder before running it. Therefore %~dp0 = A:\Chicken

stuff.cmd
:
Code:
rem install script
copy T:\Temp\Soupbone.dll %~dp0
copy T:\Temp\Hambone.dll %~dp0

rmdir T:\Temp /s /q

%~dp0\run_something_now.exe

So now we have:
overwrite=1
run file after extraction stuff.cmd
 

My Computer

System One

  • OS
    Windows 7

Latest Support Threads

Back
Top Bottom