I am trying to create a batch file that needs to be passed a path and has operations in it that requires elevation (I use mklink in it).
Here is how to recreate the problem.
- Make a .bat file that just contains
pause - Make a shortcut to that batch file.
- Create 2 folders,
C:\ThisWillWorkandC:\This Will Fail - Try dragging each folder on to the shortcut. Both should work.
- Change the shortcut settings and check in the advanced options options that it requires administrator privileges.
- Try dragging each folder again,
C:\ThisWillWorkwill behave the same butC:\This Will Failwill flash the command prompt and immedatly close itself.
This is being done on Windows 7 64-bit.
What can I do to accomplish my goal? Is there a way to allow me to use mklink without elevation? Do I need to switch from using windows batch files to something else (powershell maybe)? What else can I use to be able to write a script to delete a folder then recreate it with as a directory symlink to the folder I dropped on it?