如何打开和编辑windows.lnk快捷方式文件?

虽然大多数人永远不需要打开.lnk文件来编辑它,但在少数情况下可能需要或需要它。但是如何打开和编辑快捷方式文件呢?今天的超级用户问答有答案。...

如何打开和编辑windows.lnk快捷方式文件?

虽然大多数人永远不需要打开.lnk文件来编辑它,但在少数情况下可能需要或需要它。但是如何打开和编辑快捷方式文件呢?今天的超级用户问答有答案。

今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。

问题

超级用户读者Jez想知道如何打开.lnk文件以查看“内容”并在需要时编辑它们:

A .lnk file in Windows is an actual file intended to be a shortcut to another file, but I really do want to view the contents of the .lnk file itself. However, I am finding it literally impossible to do so.

No matter what I try, my applicati*** are opening the contents of the file it points to (drag and drop into a text or hex editor, File –> Open from a text or hex editor, etc.).

Is there any way I can get a program to actually open the .lnk file itself instead of the file it points to?

有没有办法让Jez打开.lnk文件并编辑它们?

答案

超级用户贡献者和31415、朱利安·奈特和维纳亚克为我们提供了答案。首先,31415:

Using HxD Hex Editor, you can open .lnk files just fine, as long as you do not drag and drop them.

As a workaround, open a command prompt and rename the .lnk file with a different, non-existent extension such as .lne:

  • cd /d “X:\Folder\containing\the\shortcut” ren “some shortcut.lnk” “some shortcut.lne”

You will then be able to treat the shortcut just like a regular file. When you are done, make sure to rename the file with the original .lnk extension to restore its usual functionality.

接下来是朱利安·奈特的回答:

The whole point of a .lnk file is for Windows to treat it as a link to another file, so it should be hard to edit! Perhaps it would help if you described why you want to edit it. You can change the settings of a .lnk file by right-clicking and choosing Properties.

If you really want to edit it, you need a special tool. There are a few of these around including:

  • lnk-parser
  • LnkEditorGUI
  • lnkedit

I have not tried any of these, just Googled them.

You can also edit the properties via PowerShell (from this previous answer on Stack Overflow):

  • Copy-Item $sourcepath $destination  ## Get the lnk we want to use as a template $shell = New-Object -COM WScript.Shell $shortcut = $shell.CreateShortcut($destination)  ## Open the lnk $shortcut.TargetPath = “C:\path\to\new\exe.exe”  ## Make changes $shortcut.Description = “Our new link”  ## This is the “Comment” field $shortcut.Save()  ## Save

Since this uses the Shell COM object, you could also do this with WSH or even VBA in Office!

最后,维纳亚克的回答是:

I have tried this and it works for me on Windows 8.1:

Opening .lnk files in Notepad:

  • Just drag and drop them into the Notepad window. If you open them via the Open dialog, Notepad will open the exe file pointed to by the .lnk file.

Opening .lnk files in HxD Hex Editor:

  • Open them as you would any file using the Open dialog (File –> Open).

Opening .lnk files using the command prompt:

  • Navigate to the folder containing the .lnk files and type the command: “TYPE SHORTCUTNAME.LNK”.

Opening .lnk files in just about any program:

  • Start the command prompt, navigate to the folder where the program is located, use the command: PROGRAM_NAME.EXE “path to LNK file”.

有什么要补充的解释吗?在评论中发出声音。想从其他精通技术的Stack Exchange用户那里了解更多答案吗?在这里查看完整的讨论主题。

  • 发表于 2021-04-11 08:55
  • 阅读 ( 293 )
  • 分类:互联网

你可能感兴趣的文章

如何防止windows 10在重新启动电脑后重新打开应用程序

windows10的一个习惯是在打开电脑时重新打开以前打开的应用程序。如果你不想让你的机器这样做,你宁愿从头开始打开你的应用程序,你可以禁用这个功能。 ...

  • 发布于 2021-03-10 23:33
  • 阅读 ( 277 )

如何在windows10中自定义发送到右键菜单

...备外,您可能还列出了蓝牙设备或各种外部设备。默认的Windows条目是: ...

  • 发布于 2021-03-15 15:14
  • 阅读 ( 495 )

如何在windows右键菜单中添加和删除条目

Windows做了很多正确的事情,但我们也学会了忍受很多烦恼。其中一些问题是大规模的问题,比如Windows无法启动时,但是如果您知道应该在哪里查找,您实际上可以解决许多较小的问题。 ...

  • 发布于 2021-03-16 06:46
  • 阅读 ( 298 )

什么是快捷病毒,你如何去除它?

...存驱动器、外部硬盘驱动器和SD存储卡,但当暴露于利用Windows中自动运行或自动播放的受感染设备时,可以将其传输到计算机。 ...

  • 发布于 2021-03-17 17:02
  • 阅读 ( 232 )

初学者快速自动热键指南

... 在Windows中创建新快捷方式。 自动化数据输入工作和自动填写在线表格。 扩展缩写,例如将“IDK”扩展为“我不知道” 通过键盘...

  • 发布于 2021-03-21 16:59
  • 阅读 ( 319 )

如何在windows中创建注册表项的快捷方式

虽然您可以在没有它的情况下执行大量调整,但有经验的Windows用户知道,修改注册表可以解锁Windows中的许多新功能。尽管注册表给了你很多对系统的控制,但它并不是最容易导航的工具。 ...

  • 发布于 2021-03-25 05:07
  • 阅读 ( 173 )

如何在iphone和ipad的文件夹中组织快捷方式

...。首先是易用性,其次是充分利用主屏幕小部件。下面是如何将快捷方式排序到文件夹中。 如果您的iPhone或iPad运行的是iOS 14或iPadOS 14及更高版本,您可以将所有快捷方式排序到不同的文件夹中。这比没完没了地滚动找到一条捷...

  • 发布于 2021-04-01 13:21
  • 阅读 ( 170 )

35+mac文本编辑键盘快捷键,加快打字速度

...之类的应用程序中启动新行。 类似的快捷方式也可以在Windows上使用。 相关:42+文本编辑键盘快捷键,几乎无处不在 选择文本 您可以单击并拖动以突出显示文本,但使用以下键盘快捷键可以更快地完成此操作: Shift+向左或...

  • 发布于 2021-04-01 22:28
  • 阅读 ( 231 )

如何在windows10上打开注册表编辑器

Windows和许多第三方应用程序将其设置存储在注册表中。有许多选项(特别是Windows本身的选项),您只能在注册表中更改。让我们打开注册表编辑器,这样您就可以编辑这些! 什么是注册表编辑器(the registry editor)? Windows注册...

  • 发布于 2021-04-02 11:00
  • 阅读 ( 179 )

如何在iphone上将实时照片转换为视频或GIF

...实时照片保存为GIF到您的相机卷。 相关:什么是GIF,你如何使用它们? 将实时照片效果保存为gif 如果不想将实时照片转换为其他格式,可以使用实时照片的循环效果作为解决方法。 从照片应用程序中选择实时照片,然后向上...

  • 发布于 2021-04-02 22:54
  • 阅读 ( 363 )
bcxgmnuqfr
bcxgmnuqfr

0 篇文章

相关推荐