Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

invoke-expression and passing variables (local computer no remote session)

$
0
0

Newbie here on PS…

 

Here’s the sample code…

 

$a = “Litware”

 

$cmd = “.\$a.helloworld.ps1”

 

Invoke-expression $cmd

 

Fails with “….the term ‘.\litware.helloworld.ps1’  is not recognized as the name of a cmdlet…”

 

Whereas, I can simply run manually .\litware.helloworld.ps1 in a PS shell and it works fine…

 

I think I’m missing some steps…

 

Appreciate any advice or guidance here…

 

TIA

 

Magellan

 

 


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>