|
本帖最后由 黑中见白 于 2021-12-31 05:41 编辑
要求,安装微软商店里的powershell版本
然后powershell.exe,备份一下,
cmd /c Reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\powershell.exe" /v "AppExecutionAliasRedirect" /t REG_DWORD /d "1" /f
cmd /c Reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\powershell.exe" /v "AppExecutionAliasRedirectPackages" /t REG_SZ /d "*" /f
set c="%SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"
set a="%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe"
del %a%
del %c%
set pwsh="%LocalAppData%\Microsoft\WindowsApps\Microsoft.PowerShell_8wekyb3d8bbwe\pwsh.exe"
cmd /c mklink /h %a% %pwsh%
cmd /c mklink /h %c% %pwsh%
pause
exit 结束
##查看版本命令
<# :
@powershell -ex bypass -c "icm ([scriptblock]::Create((gc '%~f0' -Raw -Encoding UTF8)))"
exit
#>
#-WindowStyle Hidden
$psversiontable #查看ps版本
Write-Host -ForegroundColor Red ('等待20秒自动退出' ) #计算时间差
Start-Sleep -Milliseconds 20000
Stop-Process -Id $pid
|
|