Mklink is not a standalone executabe, it's built-in to the Command Prompt (cmd.exe). It can't run directly from PowerShell.
So easiest thing to do is open an actual Command Prompt, type 'mklink' and you'll get the built-in help.
Keith
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want to use MKLINK (in Powershell) to sync a folder to OneDrive.
There are many articles about using this is Windows 10.
But I get this message from Powershell:
mklink : The term 'mklink' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
How do I get access to MKLINK?
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Mklink is not a standalone executabe, it's built-in to the Command Prompt (cmd.exe). It can't run directly from PowerShell.
So easiest thing to do is open an actual Command Prompt, type 'mklink' and you'll get the built-in help.
Keith
Answer accepted by question author
If you really want to launch from PowerShell, as part of a script, perhaps, you need to Use Start-Process. The docs actually contain a great example of launching a Command Prompt and executing the 'dir' command (except /c parameter should be changed to /k like so:
PS
C:> Start-Process
-FilePath
"$env:comspec"
-ArgumentList
"/k","dir",""%systemdrive%\program files""
So you would use some like:
Start-Process -FilePath "$env:comspec" -ArgumentList "/k", "mklink", "/j", ""<Link Path>"",""<Target Path>""
Keith
Answer accepted by question author
You're welcome. Things can be simplified somewhat by using the built-in PowerShell commands to create Symbolic Links:
https://docs.microsoft.com/en-us/powershell/wmf/5.0/feedback_symbolic
Please mark one or more of my replies as 'Answer' to help others who happen across this thread.
Keith
Hi, MDougC
Check these links, I hope it helps.
https://www.computerhope.com/mklink.htm
https://superuser.com/questions/1020821/how-to-...
https://www.howtogeek.com/howto/16226/complete-...
Note: This is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.
Thank you, Keith. You have taught me something new.
It seems that Microsoft would provide a better way to sync folder to OneDrive (other than the built-ins).