New
#1
UAC - All Batch Files Fail when Run-as-Administrator
On only one of my Win7 boxes, any attempt to run a batch file with Run-as-Administrator produces the following error dialog.
Title:
C:\Users\eewiz\Desktop\Test.bat
Message:
Windows cannot access the specified device path or file. You may not have the appropriate permissions to access the item.
It is the "HKCR\batfile\shell\runas\command" registry key that controls the running of elevated batch files on cmd.exe.
The registry key contains one entry "(Default) REG_SZ %SystemRoot%\System32\cmd.exe /C "%1" %*"
This is the correct string for this registry key.
I verified against other correctly working Win7 boxes.
If I drop %systemroot% on the run dialog, "C:\Windows" opens, so that's not the issue.
I copied cmd.exe from System32 to C:\Temp.
I changed the registry key from "%SystemRoot%\System32\cmd.exe /C "%1" %*" to
"C:\Temp\cmd.exe /C "%1" %*"
Now I can elevate batch files without a hitch.
I set the key to ""%SystemRoot%\System32\cmd.exe /K"
This should simply open a command window that remains open.
It does not, I get the same error.
I is apparent that this issue has nothing to do with any of the batch files themselves.
I cannot elevate any batch file on any local or remote drive unless I copy cmd.exe to a an unprotected folder (sort of).
Windows makes me answer a UAC prompt to copy cmd.exe to all of these destinations:
C:\, C:Windows, C:\Program Files and C:\Program Files (x86).
There is no UAC prompt to copy cmd.exe to \Temp.
If cmd.exe is in C:Windows or C:Windows\System32. I get the error message.
If cmd.exe is in C:\, C:\Program Files, C:\Program Files (x86) or C:\Temp. Elevated batch files work.
Of course I change the registry key to point to directory for whichever cmd.exe is under test.
The C:Windows and System32 folder permissions are identical to other boxes that work.
All of the related registry permissions also appear identical to other boxes that work.
Please! I need help to troubleshoot this issue.