正文
简介
[scode type="blue"]由于win10 ltsc2019 不带有windows store 应用商店,所以导致有些应用比如"照片"的获取很不方便,但是自己手动输入命令又过于麻烦,所以就想着写个脚本来实现。[/scode]
脚本构成
appStore 目录
[scode type="share"]
存放应用商店包
[/scode]
path.bat
[scode type="share"]允许运行未知来源的powershell
脚本[/scode]
@ECHO OFF
setlocal EnableDelayedExpansion
color 02
title 安装微软商店脚本 - for 小渔
PUSHD %~DP0 & cd /d "%~dp0"
%1 %2
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :runas","","runas",1)(window.close)&goto :eof
:runas
powershell Set-ExecutionPolicy RemoteSigned
::启用执行.ps1
exit
install.ps1
[scode type="share"]核心脚本[/scode]
param([switch]$Elevated)
function Test-Admin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
if ((Test-Admin) -eq $false) {
if ($elevated)
{
# tried to elevate, did not work, aborting
}
else {
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition))
## 核心 ##
cd D:\appstore\ #进入目录#
get-appxpackage *store* | remove-Appxpackage #清除残留#
Add-AppxPackage * #安装程序#
start shell:AppsFolder\Microsoft.WindowsStore_8wekyb3d8bbwe!App #启动程序#
}
exit
}
'请等待30S左右,应用商店正在部署中,部署完毕会自动打开。'
[scode type="share"]启用未知来源脚本等待生效后5S再运行安装脚本[/scode]
robocopy appStore d:/appstore /e
path.bat && Timeout 5 && PowerShell.exe -file install.ps1
脚本下载
[button color="info" icon="glyphicon glyphicon-download-alt" url="https:\/\/pan.yuos.top\/s\/VKFp" type="round"]小渔网盘[/button]
[button color="info" icon="glyphicon glyphicon-download-alt" url="https:\/\/wwi.lanzoui.com\/iUeEIpnw4ze" type="round"]蓝奏云[/button]
使用说明
[scode type="blue"]使用说明:
鼠标右键 >>>>运行 安装.bat 即可
[/scode]