PDA

View Full Version : Quickly zip to Extension (Ext) from Windows file menu (or Mod or Pak)



valeros
June 5th, 2020, 20:52
To quickly make an extension file from a directory from the Windows menu

https://i.imgur.com/wKBjbtP.jpg

Create a file named "sendToExt.ps1" with contents of:


$extensionDirectory = "$args"
$zipFile = $extensionDirectory + ".zip"
$extFile = $extensionDirectory + ".ext"
If (Test-path $zipFile) { Remove-Item $zipFile }
If (Test-path $extFile) { Remove-Item $extFile }
Add-Type -assembly "system.io.compression.filesystem"
::CreateFromDirectory($extensionDirectory, $zipFile)
Rename-Item $zipFile -NewName $extFile


*Note: this script will keep the original directory but will delete or overwrite any existing .zip or .ext files with the same name


Then to add to the Windows menu, you have two choices:
1) To add under the "Send To" menu:
a) Create a shortcut to the powershell script
b) Put the shortcut in "C:\Users\<your user name>\AppData\Roaming\Microsoft\Windows\SendTo" (or just paste "shell:sendto" in file explorer)
b) Change the properties of the shortcut to have target of: powershell.exe "<path to powershell script>\\sendToExt.ps1"

2) To have as a separate menu item
a) Create a file name "regAddExt.reg" with contents of:


Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\directory\shell]
@="Send To FG Ext"

[HKEY_CURRENT_USER\Software\Classes\directory\shell \Send To FG Ext\command]
@="powershell [I]<path to powershell script>\\sendToExt.ps1 \"%1\""

b) Double-click to run the file which edits the Windows registry



You can easily modify this to make Mod or Pak files as well by changing the names to ".mod" or ".pak" instead

LordEntrails
June 6th, 2020, 02:38
Nice, thx for sharing.