2

I've seen Use mklink in msys - however, the answer there:

cmd //c 'mklink link target'

... requires that you start a MSYS2 shell with administrative privileges first.

What I would like instead, is start the MSYS2 shell normally, and then type some sort of an equivalent to sudo, which would then trigger the Windows administrative prompt, just for that command.

I am aware that there is Windows runas ( https://stackoverflow.com/questions/5944180 ) command; so I tried something like this, to create a symlink in current directory:

$ cmd //c runas //user:Administrator "cmd /c mklink myscript.py `cygpath -w /c/path/to/myscript.py`"
Enter the password for Administrator:

... however, it does not wait for me to enter anything at the prompt (plus, there is no Administrator password in this case, so it is irrelevant) - but more importently, no GUI dialog is raised for UAC elevation, and the above command just exits, not making any kind of symlink whatsoever.

So, is it possible to type a single command like the above in MSYS2 with runas, which would raise an administrative elevation Windows dialog, and then actually create the symlink, if I've said yes in the dialog? If not, why cannot one use runas in a case like this?

sdaau
  • 5,316
  • 8
  • 60
  • 77
  • The linked question is 7 yeas ago. Windows 10 allows to make symbolic links with development mode turned on. Can you add the Windows 10 full version? Do you have access/permission to add registry or change settings? – Biswapriyo May 01 '20 at 13:37

0 Answers0