Create script for Appstore downloads #41
This commit is contained in:
parent
a27dafd2d7
commit
a66fb933ef
12
apps/Download-AppxFromStore.cmd
Normal file
12
apps/Download-AppxFromStore.cmd
Normal file
@ -0,0 +1,12 @@
|
||||
@echo off
|
||||
|
||||
IF %1.==. GOTO USAGE
|
||||
|
||||
powershell -command .\Download-AppxFromStore.ps1 %1
|
||||
GOTO END
|
||||
|
||||
:USAGE
|
||||
echo "usage: %0 <Store URL>"
|
||||
|
||||
:END
|
||||
|
@ -3,7 +3,8 @@
|
||||
#>
|
||||
|
||||
Param (
|
||||
[Parameter(Mandatory=$True)] [string] $StoreURL
|
||||
[Parameter(Mandatory=$True)] [string] $StoreURL,
|
||||
[Parameter(Mandatory=$False)] [string] $SavePath
|
||||
)
|
||||
|
||||
if ($StoreURL.EndsWith("/")) {
|
||||
@ -17,9 +18,7 @@ $wchttp.Headers[[System.Net.HttpRequestHeader]::ContentType]="application/x-www-
|
||||
$HtmlResult = $wchttp.UploadString($URI,$myParameters)
|
||||
|
||||
$start=$HtmlResult.IndexOf("<p>The links were successfully received from the Microsoft Store server.</p>")
|
||||
write-host $start
|
||||
|
||||
if ($Start -eq -1) {
|
||||
if ($start -eq -1) {
|
||||
write-host "Could not get the links, please check the StoreURL."
|
||||
exit
|
||||
}
|
||||
@ -37,15 +36,14 @@ try {
|
||||
$newHtml.write($src)
|
||||
}
|
||||
|
||||
$ToDownload=$newHtml.getElementsByTagName("a") | Select-Object textContent, href
|
||||
if ( !$SavePath ) {
|
||||
$SavePath=($StoreURL -split "/").split()[-2]
|
||||
}
|
||||
|
||||
$LastFrontSlash=$StoreURL.LastIndexOf("/")
|
||||
$ProductID=($StoreURL -split "/").split()[-2]
|
||||
|
||||
if (!(test-path "$ProductID")) {
|
||||
write-host "Creating directory $ProductID"
|
||||
if (!(test-path "$SavePath")) {
|
||||
write-host "Creating directory $SavePath"
|
||||
try {
|
||||
New-Item -ItemType Directory "$ProductID" -ErrorAction Stop | Out-Null
|
||||
New-Item -ItemType Directory "$SavePath" -ErrorAction Stop | Out-Null
|
||||
} catch {
|
||||
write-host "Failed to create directory.$([System.environment]::NewLine)$_"
|
||||
write-host "Exiting..."
|
||||
@ -53,11 +51,13 @@ if (!(test-path "$ProductID")) {
|
||||
}
|
||||
}
|
||||
|
||||
$ToDownload=$newHtml.getElementsByTagName("a") | Select-Object textContent, href
|
||||
|
||||
Foreach ($Download in $ToDownload) {
|
||||
Write-host "Downloading $($Download.textContent)..."
|
||||
$wchttp.DownloadFile($Download.href, "$ProductID\$($Download.textContent)")
|
||||
$wchttp.DownloadFile($Download.href, "$SavePath\$($Download.textContent)")
|
||||
}
|
||||
|
||||
write-host "---------------------------------------"
|
||||
write-host "Download is complete. Your files are in directory [ $ProductID ] ..."
|
||||
write-host "Download is complete. Your files are in directory [ $SavePath ] ..."
|
||||
|
||||
|
2
apps/apps.txt
Normal file
2
apps/apps.txt
Normal file
@ -0,0 +1,2 @@
|
||||
https://apps.microsoft.com/store/detail/xbox-game-bar/9NZKPSTSNW4P
|
||||
|
46
apps/download-apps-from-ftp.cmd
Normal file
46
apps/download-apps-from-ftp.cmd
Normal file
@ -0,0 +1,46 @@
|
||||
@echo off
|
||||
set FTPSETTINGS=..\company\ftpsettings.cmd
|
||||
set APPSFOLDER=storeapps
|
||||
|
||||
rem ===================
|
||||
rem CONFIGFILE CHECK
|
||||
rem ===================
|
||||
|
||||
if NOT EXIST %FTPSETTINGS% (
|
||||
echo.
|
||||
echo ERROR: %FTPSETTINGS% NOT FOUND
|
||||
echo.
|
||||
echo --- please create it as follows ---
|
||||
echo set FTP_SERVER=example.com
|
||||
echo set FTP_PATH=/path/to/directory
|
||||
echo set FTP_USER=myuser
|
||||
echo set FTP_PASS=mypass
|
||||
exit /b
|
||||
)
|
||||
|
||||
echo.
|
||||
echo loading settings ...
|
||||
call %FTPSETTINGS%
|
||||
echo ++++++++++++++++++
|
||||
echo FTP_SERVER=%FTP_SERVER%
|
||||
echo FTP_PATH=%FTP_PATH%
|
||||
echo FTP_USER=%FTP_USER%
|
||||
echo FTP_PASS=xxxxxx
|
||||
echo ++++++++++++++++++
|
||||
echo.
|
||||
|
||||
rem #####################################
|
||||
rem MAIN loop ( UPLOAD apps to ftp ) ...
|
||||
rem #####################################
|
||||
|
||||
mkdir %APPSFOLDER% 2>nul
|
||||
IF EXIST %APPSFOLDER% (
|
||||
rem get all apps with wGET ...
|
||||
cd %APPSFOLDER%
|
||||
wget -nv -c -nd -N --user=%FTP_USER% --password=%FTP_PASS% ^
|
||||
ftp://%FTP_SERVER%/%FTP_PATH%/%APPSFOLDER%/*.*
|
||||
) else (
|
||||
echo WARNING: [ %APPSFOLDER% ] does not exist, cannot download ...
|
||||
)
|
||||
cd ..
|
||||
|
24
apps/download-apps-from-source.cmd
Normal file
24
apps/download-apps-from-source.cmd
Normal file
@ -0,0 +1,24 @@
|
||||
@echo off
|
||||
|
||||
set LISTFILE=apps.txt
|
||||
set APPSFOLDER=storeapps
|
||||
|
||||
IF NOT EXIST %LISTFILE% (
|
||||
echo ERROR: %LISTFILE% not found!
|
||||
exit /b
|
||||
)
|
||||
|
||||
echo using list [ %LISTFILE% ] ...
|
||||
mkdir %APPSFOLDER% 2>nul
|
||||
|
||||
rem ###################################
|
||||
rem MAIN loop ( download all apps ) ...
|
||||
rem ###################################
|
||||
|
||||
FOR /F "tokens=1" %%E in (%LISTFILE%) do (
|
||||
echo URL = [ %%E ]
|
||||
powershell -command .\Download-AppxFromStore.ps1 %%E %APPSFOLDER%
|
||||
echo.
|
||||
)
|
||||
|
||||
|
46
apps/upload-apps-to-ftp.cmd
Normal file
46
apps/upload-apps-to-ftp.cmd
Normal file
@ -0,0 +1,46 @@
|
||||
@echo off
|
||||
set FTPSETTINGS=..\company\ftpsettings.cmd
|
||||
set APPSFOLDER=storeapps
|
||||
|
||||
rem ===================
|
||||
rem CONFIGFILE CHECK
|
||||
rem ===================
|
||||
|
||||
if NOT EXIST %FTPSETTINGS% (
|
||||
echo.
|
||||
echo ERROR: %FTPSETTINGS% NOT FOUND
|
||||
echo.
|
||||
echo --- please create it as follows ---
|
||||
echo set FTP_SERVER=example.com
|
||||
echo set FTP_PATH=/path/to/directory
|
||||
echo set FTP_USER=myuser
|
||||
echo set FTP_PASS=mypass
|
||||
exit /b
|
||||
)
|
||||
|
||||
echo.
|
||||
echo loading settings ...
|
||||
call %FTPSETTINGS%
|
||||
echo ++++++++++++++++++
|
||||
echo FTP_SERVER=%FTP_SERVER%
|
||||
echo FTP_PATH=%FTP_PATH%
|
||||
echo FTP_USER=%FTP_USER%
|
||||
echo FTP_PASS=xxxxxx
|
||||
echo ++++++++++++++++++
|
||||
echo.
|
||||
|
||||
rem #####################################
|
||||
rem MAIN loop ( UPLOAD apps to ftp ) ...
|
||||
rem #####################################
|
||||
|
||||
rem folder present ?
|
||||
IF EXIST %APPSFOLDER% (
|
||||
rem UPLOAD with curl ...
|
||||
FOR %%F in (%APPSFOLDER%\*.*) DO (
|
||||
echo processing ... [ %%F ]
|
||||
curl -u %FTP_USER%:%FTP_PASS% -T %%F ftp://%FTP_SERVER%/%FTP_PATH%/%APPSFOLDER%/
|
||||
)
|
||||
) else (
|
||||
echo WARNING: [ %APPSFOLDER% ] does not exist, cannot upload ...
|
||||
)
|
||||
|
@ -28,6 +28,8 @@ for %%A in (
|
||||
showkeyplus
|
||||
vim
|
||||
vivetool
|
||||
wget
|
||||
wgetdeps
|
||||
winscp
|
||||
wub
|
||||
|
||||
@ -137,6 +139,13 @@ move /Y %T%\vivetool\*.dll %TOOLS%
|
||||
rd /S /Q %T%\vivetool
|
||||
echo.
|
||||
|
||||
echo wGET
|
||||
move /Y %T%\wget\wget.exe %TOOLS%
|
||||
rd /S /Q %T%\wget
|
||||
move /Y %T%\wgetdeps\*.dll %TOOLS%
|
||||
rd /S /Q %T%\wgetdeps
|
||||
echo.
|
||||
|
||||
echo WinSCP
|
||||
move /Y %T%\winscp\*.exe %TOOLS%
|
||||
rd /S /Q %T%\winscp
|
||||
|
@ -2,6 +2,8 @@ https://www.7-zip.org/a/7z1900-x64.msi 7z-setup.msi
|
||||
https://go.microsoft.com/fwlink/?linkid=2120254 adk-setup.exe
|
||||
https://download.sysinternals.com/files/SysinternalsSuite.zip sysinternals.zip
|
||||
https://curl.se/windows/dl-7.79.1/curl-7.79.1-win64-mingw.zip curl.zip
|
||||
https://netcologne.dl.sourceforge.net/project/gnuwin32/wget/1.11.4-1/wget-1.11.4-1-bin.zip wget.zip
|
||||
https://netcologne.dl.sourceforge.net/project/gnuwin32/wget/1.11.4-1/wget-1.11.4-1-dep.zip wgetdeps.zip
|
||||
https://github.com/git-for-windows/git/releases/download/v2.30.1.windows.1/Git-2.30.1-64-bit.exe git-setup.exe
|
||||
http://www.ardiehl.de/imapcopy/IMAPCopy.zip imapcopy.zip
|
||||
https://go.microsoft.com/fwlink/?LinkId=691209 MediaCreationTool20H2.exe
|
||||
|
|
Loading…
Reference in New Issue
Block a user