gpt4 book ai didi

powershell - 使用powershell提取.exe文件

转载 作者:行者123 更新时间:2023-12-03 16:38:02 24 4
gpt4 key购买 nike

我试图在没有任何其他工具的情况下使用 powershell 提取 .exe 文件。

我尝试使用 System.IO.Compression.ZipFile,但这仅适用于 .zip 文件。

$zip_file = Get-Item ("C:\Users\00WORK\gs\gs.exe")
$destination = Get-Item ("C:\Users\tuna")
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip_file,$destination)

也试过这个,但没有任何成功
start-process C:\Users\Downloads\gs.exe -Argumentlist "/a"

也试过这个,但再次没有任何成功
$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)
}

感谢帮助。

最佳答案

我最近也遇到了同样的问题。 Dewi 的回答对我不起作用。我是这样解决的:

mv gs.exe gs.zip
Expand-Archive -Path gs.zip

或者,如果您需要将 exe 用于其他目的,您可以在完成后将其重命名。
mv gs.zip gs.exe

请注意,您需要 PowerShell 5 或更高版本才能使用扩展归档。值得庆幸的是,这可以作为 Microsoft KB3191566 一直下载到 Win 7。 .

关于powershell - 使用powershell提取.exe文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36173481/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com