Skip to content

Commit 08f3b1a

Browse files
authored
Update fileLink.bat
已修正,绝对路径某文件夹中带有空格,导致生成失败 提升,链接文件都将生成在脚本所在目录(c盘将能直接生成在脚本所在地,非c盘需要将%userprofile%\Desktop\LinkBox\目录下生成的脚本文件拖到需要的目标目录,右键管理员运行后将在此脚本目录产生链接文件) 继续优化调整
1 parent 6643961 commit 08f3b1a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

赢11/fileLink.bat

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ set flieAttribute="--a--------"
44
set directoryAttribute="d----------"
55
::rem 设定存放脚本及映射的目录
66
set mappingPath=%userprofile%\Desktop\LinkBox\
7-
set CLinkBoxPath=%mappingPath%%~nx1
7+
set CLinkBoxPath=%mappingPath%
88
::rem 脚本所在地即为链接生成地
9-
set tagHome="%~dp0"
9+
set tagHome=%~dp0
1010
set OLinkBoxPath=%~d1\LinkBox\
1111
set Obat=%CLinkBoxPath%跨盘符需管理员权限%~n1.bat
1212
::rem 创建脚本及映射目录
13-
if exist %CLinkBoxPath% ( echo "%CLinkBoxPath%" ) else ( mkdir %CLinkBoxPath% )
13+
if exist %CLinkBoxPath% ( echo "%CLinkBoxPath%%~nx1" ) else ( mkdir %CLinkBoxPath% )
1414
::rem 核验变量
1515
echo attribute:%attribute%
1616
::echo flieAttribute:%flieAttribute%
@@ -21,13 +21,13 @@ if "C:"=="%~d1" ( goto intoC ) else ( goto intoO )
2121

2222
:intoC
2323
if %flieAttribute%==%attribute% (
24-
MKLINK /H "%tagHome%" "%~1"
24+
MKLINK /H "%tagHome%%~nx1" "%~1"
2525
echo "--a--------H"
2626
) else if %directoryAttribute%==%attribute% (
27-
MKLINK /J "%tagHome%" "%~1"
27+
MKLINK /J "%tagHome%%~nx1" "%~1"
2828
echo "d----------J"
2929
) else (
30-
MKLINK /D "%tagHome%" "%~1"
30+
MKLINK /D "%tagHome%%~nx1" "%~1"
3131
echo "-----------D"
3232
)
3333
goto end
@@ -45,17 +45,17 @@ if "C:"=="%~d1" ( goto intoC ) else ( goto intoO )
4545
) > %Obat%
4646
if %flieAttribute%==%attribute% (
4747
(
48-
echo MKLINK "%tagHome%" "%~1"
48+
echo MKLINK "%tagHome%%~nx1" "%~1"
4949
echo echo --a--------H
5050
) >> %Obat%
5151
) else if %directoryAttribute%==%attribute% (
5252
(
53-
echo MKLINK /D "%tagHome%" "%~1"
53+
echo MKLINK /D "%tagHome%%~nx1" "%~1"
5454
echo echo d----------J
5555
) >> %Obat%
5656
) else (
5757
(
58-
echo MKLINK /D "%tagHome%" "%~1"
58+
echo MKLINK /D "%tagHome%%~nx1" "%~1"
5959
echo echo -----------D
6060
) >> %Obat%
6161
)

0 commit comments

Comments
 (0)