Skip to main content
deleted 2 characters in body; edited title
Source Link
benscabbia
  • 420
  • 2
  • 5
  • 16

How do I shift the execution of an instructiona batch file from one CMD to another CMD?

This is my batch file script:

::opens new cmd in admin mode
powershell.exe -Command "Start-Process cmd -Verb RunAs" 

::this needs to execute in the previously, newly opened cmd
wmic product where name="xxx" call uninstall /nointeractive

To use the wmic it requires an elevated administrator command prompt. I found the powershell command which actually opens the cmd in admin mode, however, when I try to run the following instruction, it selects the original command prompt which is not in admin mode...

Is there any way to continue the execution of my script in the newly opened cmd window?

How do I shift the execution of an instruction from one CMD to another CMD?

This is my batch file script:

powershell.exe -Command "Start-Process cmd -Verb RunAs" 
wmic product where name="xxx" call uninstall /nointeractive

To use the wmic it requires an elevated administrator command prompt. I found the powershell command which actually opens the cmd in admin mode, however, when I try to run the following instruction, it selects the original command prompt which is not in admin mode...

Is there any way to continue the execution of my script in the newly opened cmd window?

How do I shift the execution of a batch file from one CMD to another CMD?

This is my batch file script:

::opens new cmd in admin mode
powershell.exe -Command "Start-Process cmd -Verb RunAs" 

::this needs to execute in the previously, newly opened cmd
wmic product where name="xxx" call uninstall /nointeractive

To use the wmic it requires an elevated administrator command prompt. I found the powershell command which actually opens the cmd in admin mode, however, when I try to run the following instruction, it selects the original command prompt which is not in admin mode...

Is there any way to continue the execution of my script in the newly opened cmd window?

Source Link
benscabbia
  • 420
  • 2
  • 5
  • 16

How do I shift the execution of an instruction from one CMD to another CMD?

This is my batch file script:

powershell.exe -Command "Start-Process cmd -Verb RunAs" 
wmic product where name="xxx" call uninstall /nointeractive

To use the wmic it requires an elevated administrator command prompt. I found the powershell command which actually opens the cmd in admin mode, however, when I try to run the following instruction, it selects the original command prompt which is not in admin mode...

Is there any way to continue the execution of my script in the newly opened cmd window?