Differences between Invoke-Expression and Invoke-Expression -Command

Question:

Can someone explain the differences between Invoke-Expression $test and Invoke-Expression -Command $test?

variable test is:

Answer:

Both Invoke-Expression $test and Invoke-Expression -Command $test are the same. Both will put $test into the ‘command’ parameter that is at position 1. The -Command is and optional parameter name that you can put in.

Source:

Differences between Invoke-Expression and Invoke-Expression -Command by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply