1

I have a variable that stores a command that I would like to execute.

ex:

$C = "echo 'test'"

I have one way to execute this by using the following:

powershell .($C)

however this opens a new instance of powershell. How can I go about executing that code in the same instance? I can't seem to find a way to use dot sourcing without opening that second instance.

EDIT: I can not use IEX

I am Jakoby
  • 577
  • 4
  • 19

0 Answers0