I have a .CMD file that I run by right-clicking on a file in Windows Explorer; the file that I click on gets passed as the parameter to the .CMD file. The .CMD file does some processing and then copies a file from one folder to another. It worked fine on Windows XP; on Windows 8, when the "copy" command runs, it returns the error message "Access is denied".
If I copy the file using Windows Explorer, a dialog box pops up with the message "You'll need to provide administrator permission to copy to this folder". I click on "Continue", and the file gets copied.
I don't know the details of UAC, but I know that I don't want to change permissions to allow the file to be copied without intervention. That is, I don't want the whole .CMD file to run as administrator. I want to right-click the input file, run the .CMD file, and have the dialog appear when the "copy" command tries to run; I'll then click on "Continue" to allow only the copy command to run with administrator privilege. (If there were another place in the .CMD file where a file were copied, or any other operation that required administrator privilege, I would want the dialog to appear again, to ask if it's ok to run that operation as administrator).
Can this be done?