Can I nest a command string within another command string?

1

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

windows
command-line
cmd.exe
asked on Super User Nov 7, 2013 by Zach L • edited Mar 20, 2017 by Community

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0