fix: correct Windows batch file syntax and config path consistency
Fixed critical Windows-specific bugs in portable USB scripts: - Replaced Unix /dev/null with Windows nul in all batch files - Unified config file path to use .openclaw/openclaw.json consistently - Windows-Start.bat now uses same config structure as Windows-Menu.bat Files modified: - portable/Windows-Start.bat: Fix /dev/null syntax, unify config path - portable/Windows-Menu.bat: Fix multiple /dev/null occurrences - usb-scripts/Windows-Install.bat: Fix /dev/null syntax 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
@echo off
|
@echo off
|
||||||
chcp 65001 >/dev/null 2>&1
|
chcp 65001 >nul 2>&1
|
||||||
title U-Claw Menu
|
title U-Claw Menu
|
||||||
|
|
||||||
set "UCLAW_DIR=%~dp0"
|
set "UCLAW_DIR=%~dp0"
|
||||||
@@ -86,7 +86,7 @@ echo.
|
|||||||
echo Starting gateway...
|
echo Starting gateway...
|
||||||
set PORT=18789
|
set PORT=18789
|
||||||
:find_port
|
:find_port
|
||||||
netstat -an | findstr ":%PORT% " | findstr "LISTENING" >/dev/null 2>&1
|
netstat -an | findstr ":%PORT% " | findstr "LISTENING" >nul 2>&1
|
||||||
if %errorlevel%==0 (
|
if %errorlevel%==0 (
|
||||||
set /a PORT+=1
|
set /a PORT+=1
|
||||||
if %PORT% gtr 18799 (echo No available port & pause & goto :menu)
|
if %PORT% gtr 18799 (echo No available port & pause & goto :menu)
|
||||||
@@ -154,7 +154,7 @@ set "TS=%TS: =0%"
|
|||||||
set "BK=%DATA_DIR%\backups\backup_%TS%"
|
set "BK=%DATA_DIR%\backups\backup_%TS%"
|
||||||
mkdir "%BK%" 2>nul
|
mkdir "%BK%" 2>nul
|
||||||
if exist "%STATE_DIR%\openclaw.json" copy "%STATE_DIR%\openclaw.json" "%BK%\" >nul
|
if exist "%STATE_DIR%\openclaw.json" copy "%STATE_DIR%\openclaw.json" "%BK%\" >nul
|
||||||
if exist "%DATA_DIR%\memory" xcopy /s /q "%DATA_DIR%\memory" "%BK%\memory\" >/dev/null 2>nul
|
if exist "%DATA_DIR%\memory" xcopy /s /q "%DATA_DIR%\memory" "%BK%\memory\" >nul 2>nul
|
||||||
echo Backup saved: %BK%
|
echo Backup saved: %BK%
|
||||||
pause
|
pause
|
||||||
goto :menu
|
goto :menu
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
@echo off
|
@echo off
|
||||||
chcp 65001 >/dev/null 2>&1
|
chcp 65001 >nul 2>&1
|
||||||
title U-Claw - Portable AI Agent
|
title U-Claw - Portable AI Agent
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
@@ -12,13 +12,14 @@ set "UCLAW_DIR=%~dp0"
|
|||||||
set "APP_DIR=%UCLAW_DIR%app"
|
set "APP_DIR=%UCLAW_DIR%app"
|
||||||
set "CORE_DIR=%APP_DIR%\core"
|
set "CORE_DIR=%APP_DIR%\core"
|
||||||
set "DATA_DIR=%UCLAW_DIR%data"
|
set "DATA_DIR=%UCLAW_DIR%data"
|
||||||
|
set "STATE_DIR=%DATA_DIR%\.openclaw"
|
||||||
set "NODE_DIR=%APP_DIR%\runtime\node-win-x64"
|
set "NODE_DIR=%APP_DIR%\runtime\node-win-x64"
|
||||||
set "NODE_BIN=%NODE_DIR%\node.exe"
|
set "NODE_BIN=%NODE_DIR%\node.exe"
|
||||||
set "NPM_BIN=%NODE_DIR%\npm.cmd"
|
set "NPM_BIN=%NODE_DIR%\npm.cmd"
|
||||||
|
|
||||||
set "OPENCLAW_HOME=%DATA_DIR%"
|
set "OPENCLAW_HOME=%DATA_DIR%"
|
||||||
set "OPENCLAW_STATE_DIR=%DATA_DIR%"
|
set "OPENCLAW_STATE_DIR=%STATE_DIR%"
|
||||||
set "OPENCLAW_CONFIG_PATH=%DATA_DIR%\config.json"
|
set "OPENCLAW_CONFIG_PATH=%STATE_DIR%\openclaw.json"
|
||||||
|
|
||||||
REM Check runtime
|
REM Check runtime
|
||||||
if not exist "%NODE_BIN%" (
|
if not exist "%NODE_BIN%" (
|
||||||
@@ -36,13 +37,14 @@ set "PATH=%NODE_DIR%;%NODE_DIR%\node_modules\.bin;%PATH%"
|
|||||||
|
|
||||||
REM Init data
|
REM Init data
|
||||||
if not exist "%DATA_DIR%" mkdir "%DATA_DIR%"
|
if not exist "%DATA_DIR%" mkdir "%DATA_DIR%"
|
||||||
|
if not exist "%STATE_DIR%" mkdir "%STATE_DIR%"
|
||||||
if not exist "%DATA_DIR%\memory" mkdir "%DATA_DIR%\memory"
|
if not exist "%DATA_DIR%\memory" mkdir "%DATA_DIR%\memory"
|
||||||
if not exist "%DATA_DIR%\backups" mkdir "%DATA_DIR%\backups"
|
if not exist "%DATA_DIR%\backups" mkdir "%DATA_DIR%\backups"
|
||||||
|
|
||||||
REM Default config
|
REM Default config
|
||||||
if not exist "%DATA_DIR%\config.json" (
|
if not exist "%STATE_DIR%\openclaw.json" (
|
||||||
echo First run - creating default config...
|
echo First run - creating default config...
|
||||||
echo {"gateway":{"mode":"local","auth":{"token":"uclaw"}}} > "%DATA_DIR%\config.json"
|
echo {"gateway":{"mode":"local","auth":{"token":"uclaw"}}} > "%STATE_DIR%\openclaw.json"
|
||||||
echo Config created
|
echo Config created
|
||||||
echo.
|
echo.
|
||||||
)
|
)
|
||||||
@@ -64,7 +66,7 @@ REM OpenClaw doesn't need a separate build step when installed via npm
|
|||||||
REM Find available port
|
REM Find available port
|
||||||
set PORT=18789
|
set PORT=18789
|
||||||
:check_port
|
:check_port
|
||||||
netstat -an | findstr ":%PORT% " | findstr "LISTENING" >/dev/null 2>&1
|
netstat -an | findstr ":%PORT% " | findstr "LISTENING" >nul 2>&1
|
||||||
if %errorlevel%==0 (
|
if %errorlevel%==0 (
|
||||||
echo Port %PORT% in use, trying next...
|
echo Port %PORT% in use, trying next...
|
||||||
set /a PORT+=1
|
set /a PORT+=1
|
||||||
@@ -84,8 +86,8 @@ cd /d "%CORE_DIR%"
|
|||||||
|
|
||||||
REM Check if model is configured - open Config.html for first time, dashboard for returning users
|
REM Check if model is configured - open Config.html for first time, dashboard for returning users
|
||||||
set "HAS_MODEL=no"
|
set "HAS_MODEL=no"
|
||||||
if exist "%DATA_DIR%\config.json" (
|
if exist "%STATE_DIR%\openclaw.json" (
|
||||||
findstr /c:"agent" "%DATA_DIR%\config.json" >nul 2>&1 && set "HAS_MODEL=yes"
|
findstr /c:"agent" "%STATE_DIR%\openclaw.json" >nul 2>&1 && set "HAS_MODEL=yes"
|
||||||
)
|
)
|
||||||
|
|
||||||
if "%HAS_MODEL%"=="yes" (
|
if "%HAS_MODEL%"=="yes" (
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
@echo off
|
@echo off
|
||||||
chcp 65001 >/dev/null 2>&1
|
chcp 65001 >nul 2>&1
|
||||||
title U-Claw - Extract and Launch
|
title U-Claw - Extract and Launch
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
@@ -33,7 +33,7 @@ if exist "%INSTALL_DIR%\app\core\node_modules" (
|
|||||||
if "%choice%"=="2" (
|
if "%choice%"=="2" (
|
||||||
echo.
|
echo.
|
||||||
echo Re-extracting...
|
echo Re-extracting...
|
||||||
rmdir /s /q "%INSTALL_DIR%" >/dev/null 2>&1
|
rmdir /s /q "%INSTALL_DIR%" >nul 2>&1
|
||||||
) else (
|
) else (
|
||||||
echo.
|
echo.
|
||||||
echo Launching...
|
echo Launching...
|
||||||
@@ -47,7 +47,7 @@ echo Extracting U-Claw to: %INSTALL_DIR%
|
|||||||
echo This may take a few minutes...
|
echo This may take a few minutes...
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
where tar >/dev/null 2>&1
|
where tar >nul 2>&1
|
||||||
if %errorlevel%==0 (
|
if %errorlevel%==0 (
|
||||||
cd /d "%SCRIPT_DIR%"
|
cd /d "%SCRIPT_DIR%"
|
||||||
tar xzf "%ARCHIVE%"
|
tar xzf "%ARCHIVE%"
|
||||||
|
|||||||
Reference in New Issue
Block a user