Powershell从注册表下载和解压缩

Powershell从注册表下载和解压缩,powershell,Powershell,你能帮我查一下这个密码吗 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -windowstyle hidden -noexit -command (New-Object System.Net.WebClient).DownloadFile('Url',"$env:temp\cat.zip"); Expand-Archive "$env:temp\cat.zip" -Destina

你能帮我查一下这个密码吗

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -windowstyle hidden -noexit -command (New-Object System.Net.WebClient).DownloadFile('Url',"$env:temp\cat.zip"); Expand-Archive "$env:temp\cat.zip" -DestinationPath "$env:temp\pp" -Force"
附加
HKLM\software\microsoft\windows\currentversoin\run,但在重新启动后,我输入的任何内容似乎都不起作用

你有很多引语,但它们看起来不对。您没有以引号开始命令,但以引号结束命令。这应该做到:

powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -Command "(New-Object System.Net.WebClient).DownloadFile('Url',""$env:temp\cat.zip""); Expand-Archive ""$env:temp\cat.zip"" -DestinationPath ""$env:temp\pp"" -Force"
另外,我删除了
-NoExit
,但也许您真的希望powershell保持运行

此外,powershell的executor处理编码的命令并为您提供有关如何执行的说明:
powershell.exe/?

要使用-EncodedCommand参数,请执行以下操作: $command='dir“c:\program files”'

$bytes=[System.Text.Encoding]::Unicode.GetBytes($command)

$encodedCommand=[Convert]::ToBase64String($bytes)

powershell.exe-encodedCommand$encodedCommand

您没有给我
URL
,或者我会为您编码,但这样在将复杂命令传递到powershell.exe时会帮您省去一些麻烦。下面是如何通过注册表从示例中传入命令:

powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -EncodedCommand ZABpAHIAIAAiAGMAOgBcAHAAcgBvAGcAcgBhAG0AIABmAGkAbABlAHMAIgAgAA==

如果您试图将一些更简单的命令放入注册表,但它不起作用,那么您的问题不在于PowerShell,这个问题与编程无关。当您从cmd shell运行该命令时,该命令是否按预期工作?当我将代码放入注册表时,该命令添加成功,但在重新启动后,该命令不运行,但当我打开Powershell并使用此代码运行它时(新对象System.Net.WebClient)。DownloadFile('Url',“$env:temp\cat.zip”);展开归档文件“$env:temp\cat.zip”-DestinationPath“$env:temp\pp”-Force“它工作了吗?您是否检查了系统日志以查看它不运行的原因?为什么每次用户登录时都要从web下载并解压缩zip文件?在RunOnce中,仅一次