如何使用Windows cmd下载可执行文件并运行下载的可执行文件?



目前,下面的命令在PowerShell中执行。

cmd /c bitsadmin /transfer 8 https://www.example.com/hello.exe %temp%St.exe

我需要在同一命令行中启动St.exe

你能帮帮我吗?

PowerShell 中的错误消息:

在此版本中,标记"&&"不是有效的语句分隔符。在行:1 字符:88 + cmd/c bitsadmin/transfer 8 example.com/hello.exe %temp%\St.exe && <<<<start St.exe + CategoryInfo : ParserError: (&&:String( [], ParentContainsErrorRecordException + FullQualifiedErrorId : InvalidEndOfLine

如果您使用的是 Powsershell 3.0 或更高版本,则可以尝试使用 Stop-Parsing 符号:

& cmd --% /c bitsadmin /transfer 8 https://www.example.com/hello.exe %temp%St.exe

多个命令可以放在同一行上,方法是使用分号 ';" 将它们分开。

cmd /c bitsadmin /transfer 8 https://www.example.com/hello.exe; %TEMP%St.exe

在最新版本的 Windows 中,文件中可能存在备用流,可用于识别文件是否来自外部世界并阻止运行。我以为你想下载hello.exe,然后运行St.exe.

相关内容

最新更新