如何在VBS中查找快捷方式

问题描述:

大家好,



我只是想知道如果存在快捷方式,我该如何检查它(如果MyProgram.lnk是否在桌面上退出)在VBS剧本中。



问候,

Pradeep

hi all ,

I just want to know how can I check for a shortcut if it exists (say if MyProgram.lnk is exits on a desktop or not )in VBS Script .

Regards ,
Pradeep

这里是一些寻找特定快捷方式的vbs

Here is some vbs that looks for a specific shortcut
Dim fso, msg
Dim filesearch

filesearch = "C:\Program Files\Bonjour\About Bonjour.lnk"

Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(filesearch) Then
   msg = filesearch + " exists."
Else
   msg = filesearch + " doesn't exist."
End If
wscript.echo msg



主要来自这个 M


Taken essentially from this M


文章 [ ^ ]



如果你想为当前用户找到Desktop文件夹试试这个

article[^]

If you want to find the Desktop folder for current user try this
Dim oNetW, sUName
Set oNetW = CreateObject("Wscript.Network")
Wscript.echo "User : " & oNetW.UserName
Wscript.echo "Desktop folder : " & "C:\Users\" & oNetW.UserName & "\Desktop"