Skip to content

Commit

Permalink
Update fileLink.bat
Browse files Browse the repository at this point in the history
已修正,绝对路径某文件夹中带有空格,导致生成失败
提升,链接文件都将生成在脚本所在目录(c盘将能直接生成在脚本所在地,非c盘需要将%userprofile%\Desktop\LinkBox\目录下生成的脚本文件拖到需要的目标目录,右键管理员运行后将在此脚本目录产生链接文件)
继续优化调整
  • Loading branch information
lqfy-jhc authored Sep 29, 2023
1 parent 6643961 commit 08f3b1a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions 赢11/fileLink.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ set flieAttribute="--a--------"
set directoryAttribute="d----------"
::rem 设定存放脚本及映射的目录
set mappingPath=%userprofile%\Desktop\LinkBox\
set CLinkBoxPath=%mappingPath%%~nx1
set CLinkBoxPath=%mappingPath%
::rem 脚本所在地即为链接生成地
set tagHome="%~dp0"
set tagHome=%~dp0
set OLinkBoxPath=%~d1\LinkBox\
set Obat=%CLinkBoxPath%跨盘符需管理员权限%~n1.bat
::rem 创建脚本及映射目录
if exist %CLinkBoxPath% ( echo "%CLinkBoxPath%" ) else ( mkdir %CLinkBoxPath% )
if exist %CLinkBoxPath% ( echo "%CLinkBoxPath%%~nx1" ) else ( mkdir %CLinkBoxPath% )
::rem 核验变量
echo attribute:%attribute%
::echo flieAttribute:%flieAttribute%
Expand All @@ -21,13 +21,13 @@ if "C:"=="%~d1" ( goto intoC ) else ( goto intoO )

:intoC
if %flieAttribute%==%attribute% (
MKLINK /H "%tagHome%" "%~1"
MKLINK /H "%tagHome%%~nx1" "%~1"
echo "--a--------H"
) else if %directoryAttribute%==%attribute% (
MKLINK /J "%tagHome%" "%~1"
MKLINK /J "%tagHome%%~nx1" "%~1"
echo "d----------J"
) else (
MKLINK /D "%tagHome%" "%~1"
MKLINK /D "%tagHome%%~nx1" "%~1"
echo "-----------D"
)
goto end
Expand All @@ -45,17 +45,17 @@ if "C:"=="%~d1" ( goto intoC ) else ( goto intoO )
) > %Obat%
if %flieAttribute%==%attribute% (
(
echo MKLINK "%tagHome%" "%~1"
echo MKLINK "%tagHome%%~nx1" "%~1"
echo echo --a--------H
) >> %Obat%
) else if %directoryAttribute%==%attribute% (
(
echo MKLINK /D "%tagHome%" "%~1"
echo MKLINK /D "%tagHome%%~nx1" "%~1"
echo echo d----------J
) >> %Obat%
) else (
(
echo MKLINK /D "%tagHome%" "%~1"
echo MKLINK /D "%tagHome%%~nx1" "%~1"
echo echo -----------D
) >> %Obat%
)
Expand Down

0 comments on commit 08f3b1a

Please sign in to comment.