2

您好,我试图下载一个.rar存档,mediafire但它似乎不起作用,文件没有到达特定文件夹“c:\potato”

这是我的代码:

@Echo off
echo download press any key
pause
bitsadmin.exe /transfer "JobName"
http://download1142.mediafire.com/sxd533x3fosg/ymr5y2r0yax2fx8/minecraft+generator.zip C:\Potato.exe
pause
4

1 回答 1

1

尝试这样的事情:

@echo off
setlocal EnableDelayedExpansion
set "infile=http://download1142.mediafire.com/3b1mz9yb72tg/ymr5y2r0yax2fx8/minecraft+generator.zip"
set "outfile=Potato.zip"
cd "C:\"
echo download press any key
pause
powershell.exe -Command (new-object System.Net.WebClient).DownloadFile('"%infile%"','"%outfile%"') | findstr "Exception error" >nul 2>nul
set "downloadComplete=%errorlevel%"
if %downloadComplete% neq 1 echo Something went wrong, please try again
if %downloadComplete% neq 1 pause
if %downloadComplete% neq 1 goto :eof
unzip "%outfile%" "minecraft generator.zip" >nul
unzip "minecraft generator.zip" "minecraft generator.exe" >nul
rename "minecraft generator.exe" "potato.exe"
pause

请注意,您使用的是 mediafire URL 而不是实际的文件 URL,并且您尝试将 zip 文件下载到 .exe。您应该首先将文件下载为 zip,然后使用 unzip 解压缩文件。

另请注意,您的第二个 zip 似乎受密码保护。

于 2016-01-09T13:07:06.293 回答