这样试试- Dim fso, objShell, strDesktop, strCurrentDir
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set objShell = CreateObject("WScript.Shell")
- strDesktop = objShell.SpecialFolders("Desktop")
- strCurrentDir = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\")-1)
-
- Dim objFile, strName, strLnkName, objLnk
- For Each objFile In fso.GetFolder(strCurrentDir).Files
- IF LCase(Right(objFile.Path, 4)) = ".exe" Then
- strName = fso.GetBaseName(objFile.Path)
- strLnkName = strDesktop & "\" & strName & ".lnk"
- Set objLnk = objShell.CreateShortcut(strLnkName)
- objLnk.TargetPath = objFile.Path
- objLnk.WorkingDirectory = strCurrentDir
- objLnk.Save
- End If
- Next
复制代码
|