7z a -mx9 -sfx %1.exe %1
This is what i have so far as a batch file, which if i drag and drop a file or folder onto the batch file i get a 7zip SFX on Ultra Compression under the same name as the original file. but this only works if the file is in the same folder as the batch file.
What im trying to achieve is, putting this batch file into the sendto folder so i can convert any file anywhere into a highly compressed exe, which appear in the folder of the original directory.
Any help would be greatly appreciated, im sure its simple but i haven't a clue.
Edit 29 May @ 16:50
[HKEY_CLASSES_ROOT*\shell\Compress To Exe]
[HKEY_CLASSES_ROOT*\shell\Compress To Exe\command] @="\"c:\Program Files\7-Zip\7z\" u -mx9 -sfx -r -t7z \"%1.exe\" \"%1\""
add that to registry or .reg file to create a context menu button, that's parent to the sendto.
I use the following batch file to send a file or a folder to the Send-To shortcut, which creates a self extracting 7z file in the same location as the original file/folder:
My parameters are slightly different from yours, but you can tweak them as you like.
May 29 - Edit
Added the
if exist
code so that if you send an.exe
to the batch file, it will still create a self-extracting.exe
, but with_zipped
in the filename.