Files
stgsharp/内核源代码/arrange_dir.bat
T

51 lines
1.2 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
rem 获取调用脚本的当前文件夹路径
set "current_dir=%~dp0"
rem 设置源目录和目标目录
set "source_dir=%current_dir%StgSharp"
set "target_dir=%current_dir%StgSharpDebug"
set "exclude_folders=obj bin"
rem 检查是否以管理员身份运行
:checkPrivileges
net session >nul 2>&1
if %errorLevel% neq 0 (
echo Aquiring admin...
powershell start-process -verb runas -filepath "%~0"
exit /b
)
rem 遍历源目录下的所有子文件夹
for /d %%i in ("%source_dir%\*") do (
rem 获取子文件夹名称
set "folder_name=%%~nxi"
rem 检查是否为排除的文件夹
set "exclude=false"
for %%j in (%exclude_folders%) do (
if /i "!folder_name!"=="%%j" (
set "exclude=true"
echo Exclude folders: !folder_name!
goto :next
)
)
rem 检查目标目录中是否存在同名的链接或文件夹
if exist "%target_dir%\!folder_name!" (
echo Existed folder or link deleted: !folder_name!
rmdir /s /q "%target_dir%\!folder_name!"
)
rem 创建符号链接
mklink /d "%target_dir%\!folder_name!" "%%i"
:next
)
echo All symbolic link created
pause