fix: 调整环境校验脚本
This commit is contained in:
parent
ac692e13ac
commit
c545aa7c38
Binary file not shown.
|
|
@ -9,7 +9,7 @@
|
|||
## 📋 第一阶段:前置条件检查
|
||||
|
||||
> 理论上当前使用的电脑都应该符合。若不确定,也可使用以下脚本检测一下
|
||||
> 一键检查脚本(双击打开):启动检查工具.bat
|
||||
> 一键检查脚本(双击打开):[校验脚本](./scripts/OpenClawPrecheck.exe)
|
||||
|
||||
### 1. 电脑配置要求
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -0,0 +1,55 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Run this script in Windows PowerShell to package OpenClawPrecheck.ps1 into an EXE.
|
||||
|
||||
.DESCRIPTION
|
||||
1. Automatically detects and installs the PS2EXE module.
|
||||
2. Compiles OpenClawPrecheck.ps1 into a console-less EXE.
|
||||
#>
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Get the directory of the current script
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
$sourceFile = Join-Path $scriptDir "OpenClawPrecheck.ps1"
|
||||
$targetFile = Join-Path $scriptDir "OpenClawPrecheck.exe"
|
||||
|
||||
Write-Host "`n[1/3] Checking environment..." -ForegroundColor Cyan
|
||||
|
||||
# Check source file
|
||||
if (-not (Test-Path $sourceFile)) {
|
||||
Write-Error "Error: Source file not found: $sourceFile`nPlease ensure this script is in the same directory as OpenClawPrecheck.ps1."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check and install PS2EXE module
|
||||
if (-not (Get-Module -ListAvailable -Name PS2EXE)) {
|
||||
Write-Warning "PS2EXE module not found. Installing... (Internet connection required)"
|
||||
try {
|
||||
# Install to current user scope, no admin rights required usually
|
||||
Install-Module -Name PS2EXE -Scope CurrentUser -Force -SkipPublisherCheck
|
||||
Write-Host "PS2EXE installed successfully!" -ForegroundColor Green
|
||||
} catch {
|
||||
Write-Error "Installation failed. Please try running PowerShell as Administrator.`nError: $_"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "[2/3] Packaging..." -ForegroundColor Cyan
|
||||
try {
|
||||
# -NoConsole: Critical parameter to hide the console window
|
||||
Invoke-PS2EXE -InputFile $sourceFile `
|
||||
-OutputFile $targetFile `
|
||||
-NoConsole `
|
||||
-Title "OpenClaw Environment Check" `
|
||||
-Version "1.0.0.0" `
|
||||
-Description "OpenClaw Windows 11 Pre-check Tool" `
|
||||
-Verbose
|
||||
} catch {
|
||||
Write-Error "Packaging failed: $_"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "`n[3/3] Done!" -ForegroundColor Cyan
|
||||
Write-Host "EXE generated at: $targetFile" -ForegroundColor Green
|
||||
Write-Host "You can now double-click the EXE to run it." -ForegroundColor Gray
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
@echo off
|
||||
cd /d "%~dp0"
|
||||
echo.
|
||||
echo ========================================================================
|
||||
echo OpenClaw Precheck Tool is starting...
|
||||
echo ========================================================================
|
||||
echo.
|
||||
echo [Note] Please do NOT close this window.
|
||||
echo.
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -Command "& { .\\OpenClawPrecheck.ps1 }"
|
||||
Loading…
Reference in New Issue