Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending multiple arguments to a Powershell opened with Start-Process

Tags:

powershell

So I'm using the command

Start-Process powershell -Verb runas -ArgumentList $cmds

where $cmds is

$cmds = "cd C:\", "dir"

I just want the new powershell that I'm opening to run multiple commands before it automatically closes.

like image 232
Trevor Avatar asked Mar 23 '23 20:03

Trevor


1 Answers

Change $cmds to:

$cmds = {"cd C:\"; "dir";}

like image 133
Davor Josipovic Avatar answered Apr 20 '23 00:04

Davor Josipovic