#定义可输出改变盘符变量
$DriveLetter = "D:"
$NewDriveLetter = Read-Host "请输入盘符"
#判断输入的是否为英文字母,不是英文字母则终止运行
if ($NewDriveLetter -notmatch "^[A-Za-z]$") {
Write-Host "输入无效,请输入只包含英文字母的盘符"
exit
}
#判断输入的盘符是否存在,不存在则终止运行
if (-not (Test-Path "$NewDriveLetter`:\")) {
Write-Host "输入的盘符不存在,运行终止"
exit
}
Write-Host "修改前的盘符: $DriveLetter"
Write-Host "修改后的盘符: $NewDriveLetter"
$DriveLetter = $NewDriveLetter + ":"
Write-Host "修改后的盘符变量: $DriveLetter"
#定义路径变量
$Codepath = "softwares\VSCode\VSCodeUserSetup-x64-1.49.0.exe"
$Codeinstallpath = "softwares\VSCode"
#VScode安装
$installerPath = Join-Path $DriveLetter $Codepath # 安装包.exe程序所在目录
$installPath = Join-Path $DriveLetter $Codeinstallpath # 定义安装目录
#安装程序
Write-Host "正在安装VScode"
Start-Process -FilePath $installerPath -ArgumentList "/verysilent", "/mergetasks=!runcode", "/dir=$installPath" -Wait # 安装到指定目录并静默安装完成后禁止自动运行
Write-Host "VScode安装完成!"
#robo 3t安装
$roboPath = "softwares\Robo 3T 1.4.1\robo3t-1.4.1-windows-x86_64-122dbd9.exe"
$roboinstallPath = "softwares\Robo 3T 1.4.1"
$installerPath = Join-Path $DriveLetter $roboPath # 安装包.exe程序所在目录
$installPath = Join-Path $DriveLetter $roboinstallPath # 定义安装目录
#安装程序
Write-Host "正在安装robo3t"
Start-Process -FilePath $installerPath -ArgumentList "/S", "/D=$installPath" -Wait # 安装到指定目录并静默安装
Write-Host "robo3t安装完成!"
#Another安装
$AnotherPath = "softwares\Another Redis Desktop Manager\Another-Redis-Desktop-Manager.1.5.6.exe"
$AnotherinstallPath = "softwares\Another Redis Desktop Manager"
$installerPath = Join-Path $DriveLetter $AnotherPath # 安装包.exe程序所在目录
$installPath = Join-Path $DriveLetter $AnotherinstallPath # 定义安装目录
#安装程序
Write-Host "正在安装 Another Redis Desktop Manager..."
Start-Process -FilePath $installerPath -ArgumentList "/S", "/D=$installPath" -Wait # 安装到指定目录并静默安装
Write-Host "Another Redis Desktop Manager 安装完成!"
#jdk1.8安装
$jdkPath = "apps\softwares\jdk-8u281-windows-x64.exe"
$installerPath = Join-Path $DriveLetter $jdkPath # 安装包.exe程序所在目录
#安装程序
Write-Host "正在安装 jdk1.8"
Start-Process -FilePath $installerPath -ArgumentList "/s" -Wait # 安装程序静默安装到默认目录
Write-Host " jdk1.8安装完成!"
# 安装PM2
Write-Host "正在安装PM2..."
npm install pm2@5.3.0 -g
Write-Host "PM2安装完成!"