Skip to content

Instantly share code, notes, and snippets.

@josephernest
Last active September 3, 2018 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephernest/468c772ee0ac313abf6da1a001590f71 to your computer and use it in GitHub Desktop.
Save josephernest/468c772ee0ac313abf6da1a001590f71 to your computer and use it in GitHub Desktop.
mklinkgui - make symbolic links in Windows Explorer with context menu
import win32clipboard # pip install pywin32 if needed
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment