I am trying to create a shortcut link which will run/open Command Prompt (cmd) as Administrator having present working directory (PWD) set as the supplied folder path.
What I have done:
Created a batch file with following contents, and saved as "D:\Open Admin Command Prompt.bat":
@echo off cmd /k cd "%1" echo on
Then created its shortcut in "C:\Users\Nikunj\AppData\Roaming\Microsoft\Windows\SendTo".
Then I opened the shortcut's properties -> "Shortcut" tab/page.
Set "Target" to "D:\Open Admin Command Prompt.bat" %1
(Please notice %1 at the end of the target path)
Then, clicked "Advanced" button to open "Advanced Properties" dialog box, and checked "Run as administrator"(, and closed all open dialog boxes with OK button).
Now, I am trying to open Command Prompt as Administrator by Context menu of "D:\Nikunj" folder -> Send to -> Open Admin Command Prompt.bat. The Command Prompt is opening as Administrator, but the PWD is not being set to "D:\Nikunj", instead, Command Prompt is showing error "The system cannot find the path specified.", it means %1 is not being recognized as an argument to the shortcut.
So, what should I write in place of %1, or please tell me if there is any other method.