答案1
是的,我们可以通过 VBScript 建立无效链接。
Sub Shortcut(Application,Name,Location,Icon,Hotkey)
Dim objShell,DesktopPath,objShortCut,MyTab
Set objShell = CreateObject("WScript.Shell")
MyTab = Split(Application,"\")
If Name = "" Then
Name = MyTab(UBound(MyTab))
End if
Set objShortCut = objShell.CreateShortcut(DblQuote(Location & "\" & Name & ".lnk"))
objShortCut.TargetPath = DblQuote(Application)
ObjShortCut.IconLocation = Icon
ObjShortCut.Hotkey = Hotkey
objShortCut.Save
End Sub
Sub DblQuote(Str)
DblQuote = Chr(34) & Str & Chr(34)
End Sub
并调用如下脚本:
Call Shortcut("C:\InvalidDestination","Invalid Shortcut","C:\","shell32.dll,47","CTRL+ALT+N")
答案2
我修改了@Wasif Hasan 的答案
创建一个新的文本文件,扩展名.vbs
(例如C:\Temp\createShortcut.vbs
)并粘贴以下代码片段:
Sub CreateShortcut(Application, arguments, Name, OutputFolder, Icon, Hotkey)
If arguments <> "" Then arguments = " " & arguments
With CreateObject("Wscript.Shell").CreateShortcut(OutputFolder & "\" & Name & ".lnk")
.TargetPath = Application
.arguments = arguments
.WorkingDirectory = Left(Application, InStrRev(Application, "\"))
.IconLocation = Icon
.Hotkey = Hotkey
.Save
End With
End Sub
Dim Application, arguments, Name, OutputFolder, Icon, Hotkey
Application = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
arguments = "http://www.google.com"
Name = "Shortcut to Google"
OutputFolder = "C:\Temp\"
Icon = "shell32.dll,47"
Hotkey = "CTRL+ALT+N"
Call CreateShortcut( Application, arguments, Name, OutputFolder, Icon, Hotkey)
编辑参数:
Application
,,,,,,arguments
Name
OutputFolder
Icon
Hotkey
然后保存。
打开CMD并运行wscript "C:\Temp\createShortcut.vbs"
答案3
Windows 10 不允许您编辑/创建无效链接。
创建一个文件夹 c:\temp,并将链接文件复制到 c:\temp。现在看看您是否可以在那里编辑它。您需要一个像 Ultra Edit 或类似的编辑器。即使在 c:\temp 中,链接也想正常打开。