Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Whenever I run the following command in an elevated command prompt, I get the 0x80070005 Access Denied error code. I'm assuming it's a permissions error for the child shell. I'm running the command in an elevated prompt on Winddows 7 Pro SP1.

FORFILES /P %WINDIR%\servicing\Packages /M Microsoft-Windows-InternetExplorer-* 9.*.mum /c "cmd /c echo Uninstalling package @fname && start /w pkgmgr /up:@fname /norestart"

Can place the "Runas" command within the already nested command in order to run the child shell as an admin? I don't think I can because of conflicts with quotation mark locations. If there's another way to do this, such as via a batch file, I'm open to alternative methods, although I do prefer running it as a single string.

Sidenote1: Ignore the space after the first asterisk in the command string. It was added one for aesthetics & accuracy.

Sub-question: Could I use this "fix" to circumnavigate the problem entirely? Prompt as Administrator?

Reference for Runas #1

Reference for Runas #2

share|improve this question
    
ForFiles is awkward. It always launches a subshell without elevation. Just use the FOR command instead with () to bundle the echo and pkgmgr calls in one statement after the for. –  Tonny Nov 7 '13 at 22:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.