7zip SFX not extracting files - vbscript

I'm trying to create a SFX file and run a vbs afterwards.
Here's my config file:
;!#Install#!UTF-8!
InstallPath="c:\\windows\\temp\\"
ExecuteFile="cscript.exe"
ExecuteParameters="c:\\windows\\temp\\script.vbs"
;!#InstallEnd#!
The .7z archive is not corrupt, I cn=an open and extract files.
here's how I created the .exe:
copy /b 7zS.sfx + config.txt + SylinkReplacer.7z SylinkReplacer.exe
When I run it a cmd windows flashes I have the feeling it's trying tu run the vbs but I can see it has not been extracted in C:\windows\temp.
I ran process monitor and apparently it extract the files in my users' %appdata% within a temporary folder named 7zNNNNNN which gets deleted afterwards.
Any suggestion? Thanks

I found a way to make it work (I actually found it on stackoverflow but now I can't find it anymore).
;!#Install#!UTF-8!
ExecuteFile="ReplaceSylink.vbs"
;!#InstallEnd#!
This is not the best solution since I wanted it to run it with cscript (console) while on many servers the default engine is wscript (GUI).
I'll use something to force cscript like this on this one http://www.robvanderwoude.com/vbstech_engine_force.php

Related

Batch file to rar and password (very specific)

I was trying to make a batch file that compresses a specific folder (using winrar) to a specific location (not the same as the folder location), password (that I can choose myself) protects it AND does all of that without a cmd screen popping up.
I have very little knowledge of programming and managed to get some things working, but not all at the same time and in the same batch file.
Also to rar that file do I need Winrar to be installed on the computer or can I reffer to the rar.exe (copied from the Program Files Windows folder to a different location)?
AFAIK it's not possible to run a a bat file without a visible CMD window without using any additional tools. Here's a link to a post how to run a hidden console: https://superuser.com/questions/62525/run-a-batch-file-in-a-completely-hidden-way
It is possible to use just the rar.exe but I would use 7zip instead. The performance is way better, it's also portable and you have many options in the command line. So your project would contain the bat file itself, the vb script file and the 7z.exe (or rar.exe). If you want, you can even create a single .exe file out of these three by creating a SFX file: http://www.7zsfx.info/en/
Hope I could help you.

how could I run/execute a text file as a exe using batch

I need to know how I could make a batch file that would execute / run a txt file as if it was an exe file. Does any one know what I could do or try. I am using windows 7 ultimate 32 bit. The txt file is an exe just with the .txt extension.
If it is an EXE, why is it named .txt?
Sometimes EXEs are renamed to be able to send them per EMail (some Email-servers are blocking EXEs for security reasons)
Best way is to rename it to .exe
If you really want to stay it as .txt make a copy:
copy file.txt file.exe
file.exe
Note: Don't run any executable if you don't fully trust the source!
One way might be to alter the HKEY_CLASSES_ROOT\txtfile\shell\open\command registry key to change what happens when .txt files are opened.
The default setting is to open with notepad.exe
%SystemRoot%\system32\NOTEPAD.EXE %1
Another way could be to rename the file to.exe, run it, rename it .txt when finished.
There's no need for copying the .txt file to a .exe extension.
This only works if the file is executable
Simply put in batch script:
call yourfilename.txt
or just open CMD and type the same thing, this works only if the .exe file
was renamed to .txt extension, same works as for .run, .dat, .bin, .bmp and
so on, for example:
call chrome.x
or lets try starting CMD with .bmp extension
call cmd.bmp
This will work on all the files that have executable code, other files will not work!

Parameters for extracted .exe setup

I have a SampleApp.exe. When I double click it, it extracts itself into a folder (lets say a folder name SampleAppFolder and YES it do ask for a folderpath) and starts a Setup.exe from that folder (Setup.exe is extracted in SampleAppFolder). I want to run SampleApp.exe in silent mode. So I created a batch file as
"D:\Softwares\SampleApp.exe" /S /V" /quiet"
Everything gets extracted in SampleAppFolder silently but when it triggers Setup.exe from the folder, I am able to see a window. But I wanted to run even this .exe in silent mode. So I guess I need to pass some parameters for this setup.exe also. But I am not sure how. Any pointers please?
On more thing, I changed the above query as
"D:\Softwares\SampleApp.exe" /extract"C:\Users\MyName\Desktop\TestFiles123" /S /V" /quiet"
I thought the extraction path will change, but nothing happened and the files got extracted to default location again. Any pointers? Thanks
Try opening it up in 7-zip. It can extract files from most installers and you can choose where to extract them (and which ones if you're only looking for a couple).
7-Zip Website Link

How to run exe before or after "RunProgram" from 7zip sfx files setting on config.txt?

I am using 7zip to pack an installation (im using 7z because i need it to work in linux and windows).
From what i've been reading the config.txt file can contains this:
;!#Install#!UTF-8!
RunProgram="Installer.exe"
;!#InstallEnd#!
But what if i need to run another exe before or after running installer.exe? Is it possible like it is in NSIS?
You can specify another progrem in 'RUnProgram' config parameter. Lets say its some .bat file. At the moment program is run, files are already extracted at TEMP location. As your .bat will run then, it can call Installer.exe once script is finished preparations.

Why does 7zip Ignore my InstallPath when making a SFX installer?

Currently, I am making a SFX with 7zip using the following config:
;!#Install#!UTF-8!
InstallPath="C:\\test"
GUIMode="2"
RunProgram="7z465.exe"
;!#InstallEnd#!
I then package 7z465.exe into Setup.7z, and then call the following line in a batch file:
copy /b "C:\Program Files\7-Zip\7zSD.sfx" + config.txt + ".\Release\Setup.7z" .\Release\Setup.exe
When I run the resulting Setup.exe, It extracts fine and launches the 7z465.exe as well, but it is still extracting to some 7zip temp folder for the current user and not C:\test!
Running as administrator seems to have no effect either.
Anyone have any idea why this is happening?
Use modified 7zsd.sfx from http://7zsfx.solta.ru. InstallPath only works with the modified package.
I never found out why this was happening, and after hours of struggling with it, I switched to WinRAR. Granted, its got some quirks of its own, but I was at least able to figure those out and get it running for my needs.
Would recommend WinRAR over 7z for SFX stuff.

Resources