Here's what I'm trying to do:
@ECHO OFF CALL powershell -ExecutionPolicy RemoteSigned -Command "$sh = new-object -com 'Shell.Application'; $sh.ShellExecute('powershell', '-NoExit -Command "$path = """HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}""";echo $path"', '', 'runas')" PAUSE Basically, I want to have a batch file that I can double-click, which will run a powershell script that calls another powershell script but asks for admin privileges and runs that command as admin.
I'm having problems though, with the double-quotes I think... I've tried many things but can't seem to fix it, here's the powershell error message:
Bad numeric constant: 4D. At line:1 char:57 + $path = HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4D <<<< 36E972-E325-11C E-BFC1-08002BE10318};echo $path + CategoryInfo : ParserError: (4D:String) [], ParentContainsError RecordException + FullyQualifiedErrorId : BadNumericConstant PS C:\Windows\system32>