0

So I'm trying to move Whatsapp Desktop's media folder from C drive on Windows 10, where I have limited space, to E. I closed Whatsapp (also via the task manager). I moved the media directory to E, and now trying to create a link from the existing location in C, to the new location in E like this:

mklink d/ E:/target C:/original

No matter what variation I try, I get Invalid switch E:/target. Perhaps I got confused between source and target? I tried this:

mklink d/ C:/original E:/target

And got Invalid switch C:/original. I ran the command from cmd prompt with admin privileges. I double checked all paths. I even tried a dummy target path which for sure exists, is empty and the path to it is correct, same result. I tried /h instead of d/, but keep getting Invalid switch.

I previously managed to do a similar action on this computer, creating a link and moving Windows Installer directory to E. But can't seem to recreate it due to above snag.

Any further ideas what might be the issue?

1
  • The syntax should be mklink /d <link> <target>, not d/.
    – harrymc
    Commented Sep 25, 2023 at 13:48

1 Answer 1

0

Many older Windows command-line tools, especially those built into cmd.exe (surprisingly MKLINK is indeed built-in and not a mklink.exe), have a peculiar command-line parser that thinks any parameter that contains a / is an option switch, even if it is not separated from the rest by space – perhaps a relic of the original DEC influence (DCL commands worked the same way).

(For example, dir Desktop/a is handled like dir /a Desktop and not as dir Desktop\a.)

So when you write E:/target, mklink thinks you're specifying E: as path and /target as an option switch. To avoid this, always write paths using Windows-style backslashes whenever dealing with cmd.exe commands, i.e. use E:\target instead.


Note that the switches are always written as /d, not d/.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .