相关疑难解决方法(0)

有没有办法捕获ctrl-c并要求用户确认?

用户按ctrl-c可以轻松终止Powershell脚本.有没有办法让Powershell脚本捕获ctrl-c并要求用户确认他是否真的要终止脚本?

powershell copy-paste

6
推荐指数
1
解决办法
8489
查看次数

在Windows命令提示符/ PowerShell中下载大文件

我现在有点没钱了...

尝试1

在Powershell中使用iwr。它可以工作,显示进度,但速度慢10倍,直到文件在内存中才刷新:(。

 powershell -command "& { iwr https://github.com/mitchellspryn/AirsimHighPolySuv/releases/download/V1.0.0/SUV.zip -OutFile SUV.zip }"
Run Code Online (Sandbox Code Playgroud)

尝试2

在Powershell中使用.Net webclient。它有效,但是没有任何进展,您无法通过Ctrl + C :(。终止。

powershell -command "& { (New-Object System.Net.WebClient).DownloadFile('https://github.com/mitchellspryn/AirsimHighPolySuv/releases/download/V1.0.0/SUV.zip', 'SUV.zip') }"
Run Code Online (Sandbox Code Playgroud)

尝试3

在Powershell中使用BITS传输。它可以工作,显示进度并且几乎完美……直到您发现它神秘地在GitHub上不起作用(错误禁止403)!

powershell -command "& { Start-BitsTransfer -Source https://github.com/mitchellspryn/AirsimHighPolySuv/releases/download/V1.0.0/SUV.zip -Destination SUV.zip }"
Run Code Online (Sandbox Code Playgroud)

powershell command-line webclient-download microsoft-bits

5
推荐指数
2
解决办法
2220
查看次数