Question:
I am trying to extract .exe file using powershell without any other tools.
I tried to use System.IO.Compression.ZipFile, but that works only for .zip files..
1 2 3 4 |
$zip_file = Get-Item ("C:\Users\00WORK\gs\gs.exe") $destination = Get-Item ("C:\Users\tuna") [System.IO.Compression.ZipFile]::ExtractToDirectory($zip_file,$destination) |
Also tried this, but without any success
1 2 |
start-process C:\Users\Downloads\gs.exe -Argumentlist "/a" |
Tried also this but once again without any succes
1 2 3 4 5 6 7 |
$shell = new-object -com shell.application $zip = $shell.NameSpace(“C:\Users\00WORK\gs\gs.exe”) foreach($item in $zip.items()) { $shell.Namespace(“C:\Users\tuna”).copyhere($item) } |
Thanks for help.
Answer:
If you have tried
1 2 |
start-process C:\Setup.exe -Argumentlist "/a" |
Then it is not possible using powershell, this command is completely dependant on how the file was packaged, if all else fails I personally would use a utility like 7-Zip, but as you said you would not like to use utilities.