【问题标题】:How to use Windows cmd to download an executable file and run the downloaded executable?如何使用 Windows cmd 下载可执行文件并运行下载的可执行文件?
【发布时间】:2019-03-09 11:23:11
【问题描述】:
目前,在 PowerShell 中执行的以下命令有效。
cmd /c bitsadmin /transfer 8 https://www.example.com/hello.exe %temp%\St.exe
我需要在同一命令行中启动St.exe。
你能帮帮我吗?
PowerShell 中的错误信息:
标记“&&”在此版本中不是有效的语句分隔符。在 line:1 char:88 + cmd /c bitsadmin /transfer 8 example.com/hello.exe %temp%\St.exe &&
【问题讨论】:
标签:
windows
powershell
cmd
【解决方案1】:
如果您使用的是 Powsershell 3.0 或更高版本,您可以尝试使用 Stop-Parsing 符号:
& cmd --% /c bitsadmin /transfer 8 https://www.example.com/hello.exe %temp%\St.exe
【解决方案2】:
可以使用分号';'将多个命令放在同一行将它们分开。
cmd /c bitsadmin /transfer 8 https://www.example.com/hello.exe; %TEMP%\St.exe
在最近的 Windows 版本中,文件中可能存在备用流,可用于识别文件来自外部世界并阻止其运行。我以为你想下载hello.exe,然后运行St.exe。