1
Windows上に鉱山工芸品エディタMCEDITをインストールして更新するための自動化スクリプトを作成しようとしています。ここに私がこれまで持っていたものがあります。バッチでウェブサイトからファイルをダウンロードします
@echo off
REM finds the architecture of the windows installation.
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set arc=32BIT || set arc=64BIT
if %arc%==32BIT GOTO 32
if %arc%==64BIT GOTO 64
REM placeholder for testing.
set version=1.5.3.0
:32
REM attepts to use bitsadmin to download file but fails.
bitsadmin.exe /transfer "JobName" https://github.com/Khroki/MCEdit-Unified/releases/download/^%version%/MCEdit.^%version%.Win.32bit.exe .\install.exe
:64
REM another attempt at bitsadmin that also fails
bitsadmin.exe /transfer "test" /download https://github.com/Khroki/MCEdit-Unified/releases/download/^%version%/MCEdit.^%version%.Win.64bit.exe .\install.exe
REM unzips the auto extractor to current location
install.exe /s /d %cd%
:end
echo end
pause
私は最初の問題はそれです。
bitsadmin.exe /transfer "JobName" https://github.com/Khroki/MCEdit-Unified/releases/download/^%version%/MCEdit.^%version%.Win.32bit.exe .\install.exe
は常に失敗しますが、それはまた償却され、すぐにウィンドウから削除されます。私はタスクを完了するには、このスクリプトにadditonで何かをダウンロードするユーザーが必要としないネイティブのソリューションを探しています。
私が持っている2番目の問題は、現在のバージョンを取得する方法がないことです。ファイルは常にので、私は、サーバーやディレクトリを含むテキストファイルを印刷し、それをローカルに実行する方法の最新バージョンをテストするための方法が必要です
https://github.com/Khroki/MCEdit-Unified/releases/download/(version_number)/mcedit.(version_number).exe
で保存されています。
のwgetやカールなどのサードパーティ製のツールを使用せずに、純粋なバッチでファイルをダウンロードすることは不可能です。 – SomethingDark
私はbitsadminを使用していますが、私のコマンドは何らかの理由で失敗します。理由は何ですか?私はまた、Windows 7-10で動作する限り、PowerShellを使用することにオープンしています – flanigomik
いいえ、私はwgetを使用しています。私はBitsadminを働かせることは一度もありませんでした。 – SomethingDark