@echo off
echo Dim WshShell,Shortcut>%temp%\a.vbs
echo Dim path,fso>>%temp%\a.vbs
echo path="%cd%\B.exe">>%temp%\a.vbs
echo Set fso=CreateObject^("Scripting.FileSystemObject"^)>>%temp%\a.vbs
echo Set WshShell=WScript.CreateObject^("WScript.Shell"^)>>%temp%\a.vbs
echo Set Shortcut=WshShell.CreateShortCut^("%userprofile%\桌面\C.lnk"^)>>%temp%\a.vbs
echo Shortcut.TargetPath=path>>%temp%\a.vbs
echo Shortcut.Save>>%temp%\a.vbs
start "%SystemRoot%\System32\WScript.exe" "%temp%\a.vbs"
%cd%的意思就是当前目录,不管在哪都有效
那就用这个:
@echo off
set pa=%userprofile%\桌面\C.url
echo ^[InternetShortcut^]>"%pa%"
echo URL=file:\\%cd%\B.exe>>"%pa%"
echo Modified=705EC2AA0B10CA0120>>"%pa%"
echo IconIndex=0 >>"%pa%"
echo IconFile=%cd%\B.exe>>"%pa%"
个人能力有限...
有错误,改一改
Dim WshShell,Shortcut
Dim path,fso
Set fso=CreateObject("Scripting.FileSystemObject")
Set WshShell=WScript.CreateObject("WScript.Shell")
path=WshShell.CurrentDirectory +"\B.exe"
Set Shortcut=WshShell.CreateShortCut("C:\Documents and Settings\wf\桌面\C.lnk" )
Shortcut.TargetPath=path
Shortcut.Save