A few thingz
Joseph Basquin
03/12/2024
#ntfs
How to create symbolic links with Windows Explorer?
Quick tip: here is how to create symlinks in Windows without using any command line tool.
1) If you have Python installed, create mklinkgui.py
:
import win32clipboard # pip install pywin32 if you haven't installed it already
import sys, os, subprocess
fname = sys.argv[1]
win32clipboard.OpenClipboard()
filenames = win32clipboard.GetClipboardData(win32clipboard.CF_HDROP)
win32clipboard.CloseClipboard()
for filename in filenames:
base = os.path.basename(filename)
link = os.path.join(fname, base)
subprocess.Popen('mklink %s "%s" "%s"' % ('/d' if os.path.isdir(filename) else '', link, filename), shell=True)
2) Open regedit
and
-
Create a key named
Mklink here
inHKEY_CLASSES_ROOT\Directory\shell
. In this key create a subkeycommand
containing the string"C:\Python27\pythonw.exe" "C:\pathto\mklinkgui.py" "%1"
. - Create a key named
Mklink here
inHKEY_CLASSES_ROOT\Directory\Background\shell
. In this key create a subkeycommand
containing the string"C:\Python27\pythonw.exe" "C:\pathto\mklinkgui.py" "%v"
(please note the%v
here).
How to use it?
-
First click on the file(s) or folder(s) that you want to create a symbolic link to. Do
CTRL+C
orCopy
. (It works with multiple files!) - Right click on the folder where you want to drop a link, choose
Mklink here
, done!