解决mklink命令生成快捷方式无法显示预览图的问题

Windows, 折腾 2024/02/15

起因

虽然Windows资源管理器自带了收藏夹的功能,但是貌似是只能收藏单个文件,并不能收藏文件夹,不太方便

所以就想着直接生成文件或者文件夹的快捷方式(shortcut,后缀为.lnk),然后将这个快捷方式丢到一个指定的收藏文件夹

折腾

其实只要右击文件(夹),菜单里就有这个功能

但是它只是在当前文件夹下生成一个lnk快捷方式,还需要再手动转移到收藏文件夹,依然是不方便

所以一开始我就找到了Windows下的 mklink 命令,一行命令即可解决我的需求

mklink [ [/D] | [/H] | [/J] ] Link Target

但是,立马问题就又来了,使用mklink创建的快捷方式无法显示图片或者视频的缩略图,这就扯了 :doge:

但是通过直接在文件上右键生成的快捷方式却有缩略图,如下

最后也是瞎折腾,发现上述的两种方式生成的.lnk文件还是有点区别的

解决

一番搜索,最终找到了 NirCmd 小工具,它包含一个shortcut组件,用法和 mklink 命令相似,也是在命令行下给文件或文件夹创建快捷方式

下载:https://www.nirsoft.net/utils/nircmd.zip(解压后使用nircmdc.exe)

#用法
nircmdc.exe shortcut [filename] [folder] [shortcut title] {arguments} {icon file} {icon resource number} {ShowCmd} {Start In Folder} {Hot Key}
#参数
[filename]: Create a shortcut to this filename.
[folder]: Specify the destination folder that inside it the shortcut will be created. You can specify any valid folder, including the special variables that represent system folders, like ~$folder.desktop$ (Desktop folder), ~$folder.programs$ (Start-Menu-Programs folder), and so on...
[shortcut title]: The text displayed in the shortcut.
{arguments}: Optional parameter - Additional arguments to execute the filename.
{icon file}: Optional parameter - Use this parameter if your want that the shortcut will be displayed with icon other than the default one.
{icon resource number}: Optional parameter - The resource number inside the icon file.
{ShowCmd}: Optional parameter - Use this parameter if you want to maximize or minimize the window of the program. Specify "max" to maximize the window or "min" to minimize it.
{Start In Folder}: Optional parameter - Specifies the "Start In" folder. If you don't specify this parameter, the "Start In" folder is automatically filled with the folder of the program you specify in [filename] parameter.
{Hot Key}: Optional parameter - Specifies an hot-key that will activate the shortcut. For example: Alt+Ctrl+A, Alt+Shift+F8, Alt+Ctrl+Shift+Y



评论(本站已开启评论回复邮件通知功能,请如实填写邮箱以便及时收到回复)