Kyl*_*ney 26 windows windows-7 shortcuts path windows-10
在开发我的产品时,我的测试设备同时安装了多个版本的应用程序。但是,为了获得我的应用程序用于工作的绝对路径,我需要切换或重命名文件夹,以便我要测试的版本具有正确的路径,例如C:\Program Files\My Company\My App\My App.exe
. 我已经创建了一个针对此路径的快捷方式,但是如果在当前没有任何版本具有该路径时打开此快捷方式,则该快捷方式将自动更新,认为文件已永久移动。这导致了无声的失败,直到我发现发生了什么。直到现在我才知道这是 Windows 快捷方式的功能。
所以我的问题很简单。有什么办法可以关闭这个功能吗?全局是好的,但每个快捷方式的解决方案会更好。
使用批处理文件而不是快捷方式是一种解决方案,但我想知道是否有任何方法可以在仍然使用快捷方式的同时使这项工作有效。
我正在使用 Windows 10 家庭版和 Windows 7 家庭版。
Ste*_*ven 26
停止并禁用服务:分布式链路跟踪客户端 (TrkWks)。
分布式链接跟踪在链接到 NTFS 卷上的文件的情况下跟踪链接,例如外壳快捷方式。如果该文件被重命名、移动到同一台计算机上的另一个卷、移动到另一台计算机或在其他类似情况下移动,Windows 将使用分布式链接跟踪来查找文件。
Ben*_*n N 14
您可以使用 PowerShell!这个小脚本重击 LNK 文件以产生与使用经典shortcut
实用程序相同的效果。
$linkfile = Resolve-Path $args[0]
$bytes = [IO.File]::ReadAllBytes($linkfile)
$bytes[0x16] = $bytes[0x16] -bor 0x36
[IO.File]::WriteAllBytes($linkfile, $bytes)
Run Code Online (Sandbox Code Playgroud)
要使用它,将该文本保存为.ps1
文件,例如notrack.ps1
. 如果您还没有,请按照PowerShell 标记 wiki的启用脚本部分中的说明进行操作。然后您可以从 PowerShell 提示符运行它:
.\notrack.ps1 C:\path\to\my\shortcut.lnk
Run Code Online (Sandbox Code Playgroud)
以这种方式调整的快捷方式在目标移动时不会改变。如果像这样的快捷方式被破坏,当您尝试打开它时什么也不会发生。
我从这个 LNK 格式的 48 页 Microsoft PDF 中收集了我的脚本中使用的二进制数学。
使用shortcut.exe
命令选项-s
:
shortcut: [-? -h -f -c -r -s] [[-t] target [[-n] name]] [-d working directory]
[-a Arguments] [-i Iconfile] [-x Icon index] [-u {all|[natdix]}]
[-l logfile]
-? -h This help
-f Force overwrite of an existing short cut
-c Change existing shortcut
-s Make shortcut non tracking (Stupid)
-r Resolve broken shortcut
-t target Specifies the target of the shortcut
-n name Specifies the file name of the shortcut file
-d directory Specifies the directory name to start the application in
-a arguments Specifies the arguments passed when the shortcut is used
-i iconfile Specifiles the file the icon is in
-x index Specifies the index into the icon file
-u [spec] Dumps the contents of a shortcut. 'all' is the same as 'natdix'
but the letters of 'natdix' can be specified to display specific
fields in the shortcut (repeats allowed, and order followed)
-l logfile record error messages in specified file
Run Code Online (Sandbox Code Playgroud)
您可以启用以下 GPO:
用户配置\管理模板\开始菜单和任务栏\解析外壳快捷方式时不要使用基于搜索的方法
对应的注册表项: HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoResolveSearch
用户配置\管理模板\开始菜单和任务栏\解析外壳快捷方式时不要使用基于跟踪的方法
对应的注册表项:
HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoResolveTrack
Run Code Online (Sandbox Code Playgroud)
用户配置\管理模板\Windows 组件\文件资源管理器\漫游期间不跟踪外壳快捷方式
对应的注册表项: HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\LinkResolveIgnoreLinkInfo