Files
yidaima_tools/bat/run_install_server.bat
2026-04-10 14:37:23 +08:00

47 lines
977 B
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion
:: 强制切换到脚本所在目录解决管理员模式启动默认在System32的问题
cd /d "%~dp0"
echo 正确盘符: %~d0
echo 正确路径: %cd%
:: 使用/d参数强制切换驱动器+目录
cd /d "D:\code\server" 2>nul
if %errorlevel% neq 0 (
echo [ERROR] Can not enter D:\code\server
echo 请检查:
echo 1. D盘是否存在
echo 2. code目录是否存在
echo 3. 是否有权限访问
exit /b
)
echo 扫描子目录中...
dir /ad /b
set "first_dir="
for /f "delims=" %%d in ('dir /ad /b 2^>nul') do (
set "first_dir=%%d"
goto :dir_found
)
:dir_found
if not defined first_dir (
echo [ERROR] No subdirectory found
exit /b
)
echo 进入子目录: !first_dir!
cd /d "!first_dir!"
echo 当前路径: %cd%
if not exist "target\" (
echo 执行Maven构建...
call mvn clean package
) else (
pause
echo 检测到 target 目录跳过Maven构建。
)