how to execute a powershell command inside a window started by a script

Asked

Viewed 139 times

0

I have a script.ps1 file and the first line of it is to open another powershell window:

powershell Start-Process powershell -Verb runAs

But the problem is that I need to execute other commands inside the created window.

For example:

powershell Start-Process powershell -Verb runAs
echo ola

I want echo ola to run in the window I created in the first line and not in the default window I used to run the script

1 answer

0

Something to that effect?

powershell Start-Process powershell -Verb runAs  {echo hello; Read-Host} 
  • If you have a new question, ask it by clicking the button Ask question. Include a link to this question if it helps provide context. - Of Revision

  • 1

    I don’t understand why your comment @Kayobruno

Browser other questions tagged

You are not signed in. Login or sign up in order to post.