用批处理写:把当前文件夹在桌面建立一个快捷方式

来源:百度知道 编辑:UC知道 时间:2024/06/15 11:59:49
当前文件夹为A,其中有程序B、文件夹C. 假设建立批处理程序D。

要求:
运行D,则在桌面建立A、B、C的快捷方式
并且,使B在C中也创建一个快捷方式
上次那个ABC的也是我提的,你给回答了,不过好像有点问题。压缩包做的安装程序本来都是解压到压缩包所在文件的,用了你写的bat后,都成了解压到快捷方式所在文件夹了。这次只要回答正确,以后涨的分也都给你

setlocal enabledelayedexpansion
for %%i in ("%cd%\C" "%cd%\B.exe" "%cd%") do (
set b=%%i
set c=!b:*\=!
set d=!c:*\=!
set e=!d:*\=!
set f=!e:*\=!
set g=!f:*\=!
set h=!g:*\=!
set i=!h:*\=!
set j=!i:*\=!
set k=!j:*\=!
set l=!k:*\=!
set m=!l:*\=!
set n=!m:*\=!
set o=!n:*\=!
set p=!n:"=!
echo Dim WshShell,Shortcut>%systemroot%\temp\tmp.vbs
echo Dim path,fso>>%systemroot%\temp\tmp.vbs
echo path=%%i>>%systemroot%\temp\tmp.vbs
echo Set fso=CreateObject^("Scripting.FileSystemObject"^)>>%systemroot%\temp\tmp.vbs
echo Set WshShell=WScript.CreateObject^("WScript.Shell"^)>>%systemroot%\temp\tmp.vbs
echo Set Shortcut=WshShell.CreateShortCut^("%userprofile%\桌面\!p!.lnk"^)&