gpt4 book ai didi

powershell - 批量隐藏Invoke-WebRequest

转载 作者:行者123 更新时间:2023-12-03 01:28:56 28 4
gpt4 key购买 nike

我正在尝试在.bat文件中下载一个exe,但是无法隐藏输出
$progressPreference = 'silentlyContinue'| Out-Null
$null 2>&1.
我不知道为什么他们都不起作用。

这是我正在使用的脚本。

powershell "Invoke-WebRequest http://example.com/example.exe -OutFile "%UserProfileDir%\AppData\LocalLow\example_Data\example.exe"

它完美地下载了exe,但我无法隐藏输出。

最佳答案

您可以从此批处理文件中获得启发:

@echo off
set URL=https://www.google.tn/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png
set FileName=%~dp0Google_Logo.png
Call :Download %URL% %FileName%
Start "" %FileName% & Exit
::*********************************************************************************
:Download <URL> <FILE>
Powershell.exe -command "(New-Object System.Net.WebClient).DownloadFile('%1','%2')"
exit /b
::*********************************************************************************

关于powershell - 批量隐藏Invoke-WebRequest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60013048/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com