MkLink

Facebooktwitterredditpinterestlinkedinmail

Topics: windows free mklink tool symlink symbolic link junction shortcut sendto start menu fix 0x80070005 access is denied system authority psexec PinTo desktop pstools sysinternals

MkLink.pl - Freeware to quickly create Microsoft Windows shortcuts, symbolic links, hard links, and junctions in various useful locations.  Pin any file to the Start Menu or Taskbar.  Run or install any program or script or open any file with SYSTEM authority.  Fix 0x80070005 Access is Denied installation errors.

MkLink.pl is an example of a Perl script generated by PerlWizard.  You can get your free copy of MkLink.pl from one of the PerlWizard tabs when you run it.  Alternatively, you can get MkLink.pl and all of the needed supporting Perl modules by clicking the DOWNLOAD link above.

MkLink.pl requires Perl to run, but ActiveState Perl always installs without problems and MkLink.pl will make it worth the effort.

The first script you should run MkLink.pl on is MkLink.pl itself, and you should put a shortcut to it in your Send To folder.  Then in an explorer you can select a file or folder, right click it, and then direct it via the Send To choice to MkLink.pl.  Then you can create shortcuts, symbolic links, hard links, or junctions at or to any or all of the locations below and you can choose to run shortcuts with SYSTEM authority.

With MkLink.pl you can quickly create the various types of links in the following locations (except for Windows XP, which has only a subset):

·         CommonProfile

·         CommonDesktop

·         CommonStartup

·         CommonAdminTools

·         CommonPrograms

·         CommonAccessories

·         CommonSystemTools

·         CommonMaintenance

·         CommonFavorites

·         CommonStartMenu

·         CommonDocuments

·         UserProfile

·         UserDesktop

·         UserStartup

·         UserAdminTools

·         UserPrograms

·         UserAccessories

·         UserSystemTools

·         UserMaintenance

·         UserFavorites

·         UserStartMenu

·         UserDocuments

·         Links-ExplorerFavorites

·         SendTo

·         QuickLaunch

·         AppData

·         PinToStartMenu

·         PinToTaskBar

·         HomeDir

·         $CWD

·         <Drive List>

·         <MRU list>

You can navigate up or down from any of the above choices, so you can put your shortcut, symbolic link, hard link, or junction anywhere on your computer.

For shortcuts, MkLink.pl will ask you to specify the window handling mode for the cmd.exe window, which may be:

·         No UI (used when a normal Windows GUI program such as WinWord.exe is invoked)

·         Normal UI where the CMD window in which the file runs closes when the script or program completes.

·         Normal UI where the CMD window in which the file runs remains open and you have a CMD prompt after the script or program completes.  This is good for debugging.

For shortcuts, MkLink.pl will ask you to specify the execution authority for the target file named in your shortcut, which may be:

·        User

·        Administrator

·        System

A User shortcut is just an ordinary shortcut.  An Administrator shortcut is a shortcut set to always run as administrator, if this choice is available under Properties/Shortcut/Advanced.  For certain files "always run as administrator" is not available.  System means you can run the shortcut file as the SYSTEM user.  For more details on the SYSTEM user account see http://msdn.microsoft.com/en-us/library/windows/desktop/ms684190%28v=vs.85%29.aspx

PSExec.  To actually run a System authority shortcut, you will need to install a utility called psexec.exe that you can get from a division of Microsoft, www.sysinternals.com, in their PsTools suite.  You should only install psexec.exe if you really know what you are doing and own the computers you are installing it on or are otherwise authorized to do so.  Do not install it on your work computer without appropriate permission because you could get yourself in trouble.

Advantages of using MkLink.pl.  Creating shortcuts can result in a lot of confusion:

·         Why can't I pin my Excel file or Perl script to the Start Menu or Taskbar?

·         When I put a shortcut to a script or program in my Send To directory why does it not show up in the context menu? 

·         I found three folders named 'Start Menu' or 'StartMenu' on my computer, but when I put shortcuts into them manually why does nothing happen? 

MkLink.pl will handle all of these issues for you.  MkLink.pl will allow you to make shortcuts to any file or folder and put them virtually anywhere you want.

Things to do.  These are a few of the things you can do with MkLink.pl:

1.    As stated above, run MkLink.pl to create a shortcut link to MkLink.pl itself in your Send To menu.  Then to create more links, just right click a file or folder in explorer, hold down the right mouse button, select Send To, and drop your selection onto MkLink.pl.  I.e., once you put a link to MkLink.pl in your Send To menu, you can thereafter run MkLink.pl easily from Windows Explorer.

2.    In, say, C:\WindowsSpecialDirectoryLinks, it is handy to have symbolic links to UserDesktop, CommonDesktop, UserStartup, CommonStartup, UserFavorites, CommonDocuments, and possibly some of the other special Windows folders.  In a CMD Command Prompt window from your home directory you can then just cd to any of them, and you can always get to them easily in Explorer.  If you run MkLink.pl in C:\WindowsSpecialDirectoryLinks  from the command line, it will let you choose these special directories as the target of your link; this is much easier than navigating to them and sending them to MkLink.pl via Send To.  For all other purposes it is easiest to access MkLink.pl from the Explorer Send To context menu item.

3.    Get psexec.exe and then create the file named SysPromptHere.bat with this content:
         cd %1
         %~d1
         color 2e
         title ##SYSTEM##
         prompt ##SYSTEM##$S$P$G$S
         cmd.exe
Then create a symbolic link to SysPromptHere.bat in your SendTo directory using MkLink.pl.  Specify SYSTEM as the Authority, and take the defaults for the other options.  Now you can send any directory to SysPromptHere and the result will be to open a command prompt window for which you have system-level privileges.  Be careful what you do with it. You can choose a different color, prompt, and title, but just be certain to make it distinctive so you will know you are SYSTEM.

4.    Suppose you have a web site.  There will be numerous files on your site arranged in a directory structure.  Most likely the web hosting site directory structure and files will not match what you have on your own machine where you create your files.  Say the web host root directory is /.../www.  Create C:\www on your own machine.  Create symbolic links and directories in C:\www that exactly match what is at /.../www.  Then you can zip C:\www and easily deliver the files to your web host.  Or you can use a visual file transfer tool (E.g., BitVise Tunnelier) and update your web site with just a few button clicks.

5.    If you keep getting 0x80070005 Access is Denied installation errors when you install software and none of the other fixes you find on the Internet work for you, use SysPromptHere to install as the SYSTEM user.  You might need to repair the permissions where the files were installed, but at least you can get your software installed this way.  I have tried numerous fixes for this problem, but the SysPromptHere approach is the only one that will generally always work for me.

Caveats.  Be careful with symbolic links and junctions.  Do not create circular links.  Almost no Windows software knows not to follow circular links ad nauseum.  Fortunately Explorer Search will not follow them, but 3rd party file search tools probably will.  Do NOT delete these links from a CMD window unless you can remember a certain trick.  In a CMD window del SomeSymbolicLink will delete the contents of the directory to which it points in addition to the link itself.  This is in stark contrast to Unix, where rm SomeSymbolicLink will just delete the link and nothing else.  So if you are a Unix user, you could be in for a nasty surprise if you try deleting symbolic links or junctions from a CMD window.  The trick is you need to use rmdir, but are you going to always remember that?   Explorer does the right thing when you delete links, so just use Explorer to delete them.

More Caveats.  A lot of Windows software does NOT handle symbolic links or junctions properly.  For example, see http://www.rtbaileyphd.com/src/NG15SeriousProblem/ re Norton Ghost.  I also found out that at least some archivers such as 7-Zip  and PeaZip do not understand symbolic links or junctions at all.  At least when the archivers extracted my test dir (NG15Test) they did not wipe out my data file.  They just made 4 independent copies of what should have been just one real file, and all link info was lost.

Even the cmd.exe dir /s command will follow circular links.  It will not follow them ad nauseum, but it will follow them until some limit it reached.  In my NG15 test case dir /s found the same file 9 times.  There is no dir flag to prevent following links .

Summary.  So check out PerlWizard and get yourself a copy of MkLink.pl, but be aware of how other software like archivers and disk imagers will handle your links and do not try to del them from a CMD window.

Questions?  Contact me at $MyEmail = sprintf("%s@%s.com", 'perlwizard', 'rtbaileyphd') or see Feedback

This page was last modified Wed Jul 12 22:41:18 2017

MkLink was last modified: by