Creating shell links (.lnk) to files/folders
-
- Posts: 129
- Joined: Sun 08 Jan, 2012 08:23
- Location: Czech Republic
- Has thanked: 2 times
- Been thanked: 1 time
Creating shell links (.lnk) to files/folders
Is there any possibility to create shell link files in FAR as with http://plugring.farmanager.com/plugin.php?pid=43&l=en plugin? I mean some newer FAR3 plugin or maybe macro?
- NightRoman
- Posts: 6184
- Joined: Fri 18 Aug, 2006 13:52
- Location: Cambridge, UK
- Has thanked: 32 times
- Been thanked: 62 times
- Contact:
Re: Creating shell links (.lnk) to files/folders
If you are familiar with PowerShell then this script may help:
New-Shortcut.ps1 The second parameter is optional (<target>.lnk is assumed)
New-Shortcut.ps1 The second parameter is optional (<target>.lnk is assumed)
- NightRoman
- Posts: 6184
- Joined: Fri 18 Aug, 2006 13:52
- Location: Cambridge, UK
- Has thanked: 32 times
- Been thanked: 62 times
- Contact:
Re: Creating shell links (.lnk) to files/folders
So it is not a Far plugin. But you may connect it to Far via the user menu ([F2]), e.g. create a user menu command:
It creates lnk for the current panel item.
Code: Select all
PowerShell.exe -File ...\New-Shortcut.ps1 "!\!.!"
- John Doe
- Бюрократ
- Posts: 13855
- Joined: Wed 27 Apr, 2005 20:42
- Has thanked: 73 times
- Been thanked: 428 times
- Contact:
Re: Creating shell links (.lnk) to files/folders
EMenu plugin (included in std distribution): F11/EMenu/Context Menu/...
or via command line:
or via command line:
rclk_cmd:link <filename>
- NightRoman
- Posts: 6184
- Joined: Fri 18 Aug, 2006 13:52
- Location: Cambridge, UK
- Has thanked: 32 times
- Been thanked: 62 times
- Contact:
Re: Creating shell links (.lnk) to files/folders
Forgot to add. FarNet module PowerShellFar provides the script Invoke-Shortcut-.ps1
Description:
The script gets a target path from the shortcut file (.lnk). If it is a
directory path this directory is opened on the current panel. If it is a
file path the action depends on parameters; default action is to jump to
the target file, other actions: edit or view the file.
Switch -Panel opens a shortcut in a panel to view and edit its properties.
If you change data it asks you to save changes on exit or you can use
[CtrlS] to save data at any moment.
How to open .lnk files, e.g. by [Enter], [CtrlPgDn], [F3], [F4]:
Open menu Commands \ File Associations, add an association and set:
-- Mask: *.lnk
-- Command for [Enter]: ps: Invoke-Shortcut- #
-- Command for [CtrlPgDn]: ps: Invoke-Shortcut- -Panel #
-- Command for [F3]: ps: Invoke-Shortcut- -View #
-- Command for [F4]: ps: Invoke-Shortcut- -Edit #
[Shift-Enter] still opens shortcut files from Far in standard Windows way.
Description:
The script gets a target path from the shortcut file (.lnk). If it is a
directory path this directory is opened on the current panel. If it is a
file path the action depends on parameters; default action is to jump to
the target file, other actions: edit or view the file.
Switch -Panel opens a shortcut in a panel to view and edit its properties.
If you change data it asks you to save changes on exit or you can use
[CtrlS] to save data at any moment.
How to open .lnk files, e.g. by [Enter], [CtrlPgDn], [F3], [F4]:
Open menu Commands \ File Associations, add an association and set:
-- Mask: *.lnk
-- Command for [Enter]: ps: Invoke-Shortcut- #
-- Command for [CtrlPgDn]: ps: Invoke-Shortcut- -Panel #
-- Command for [F3]: ps: Invoke-Shortcut- -View #
-- Command for [F4]: ps: Invoke-Shortcut- -Edit #
[Shift-Enter] still opens shortcut files from Far in standard Windows way.