You try and try to make a symbolic link but mklink cannot create a file when that file already exists.
When you want to make symbolic links between two directories, mklink will work as a keyword. Suppose, you want to connect ‘any folder1’ from a directory through a shortcut to another directory, mklink will help you to do that.
However, the error means you will not able to link the below path- c:\program files (x86)\any folder1\any folder2\ to target path- d:\programs\any folder1\any folder2\
It can’t perform unless at least- c:\program files (x86)\any folder1 exists as part of the link source.
Here, you have to either link- c:\program files (x86)\any folder1
to- g:\programs\any folder1 or you have to create at least an empty folder at- c:\program files (x86)\any folder1 and then create the link- c:\program files (x86)\any folder1\any folder2 to- g:\programs\any folder1\any folder2.
May Need to Check Ransomware Protection
The error may occur if the ‘Controlled folder access’ of ‘Ransomware Protection’ is in ‘On’ mode. If so, you need to make a change in Ransomware Protection. I will attach it below.
Step 1
Tap the Windows key and type ‘ransomware protection’. Accordingly, a preface of this System Settings will appear on the screen. Click on it.
Step 2
Then you will find the ‘Controlled folder access’ in ‘On’ mode. You need to click on the ‘Block history’ from here.
Step 3
Next, try to find out the file that you couldn’t create. Most probably, you will find it in the recent items list. You have to click on it and select ‘Yes’ on the ‘User Account Control’ to confirm the submission.
Step 4
After that, grant the file as a ‘Protected folder’. Then click on ‘Actions’ and select the ‘Allow on device’ tab.
Final Words
Hopefully, the ‘mklink cannot create a file when that file already exists’ error will wipe out and you will be able to create the symbol link without facing the discussed error.