Answer the question
In order to leave comments, you need to log in
[powershell] how to execute what is in a variable?
I apologize, of course, for a stupid question
, but I myself can’t finish something.
Is it possible to somehow execute the text in a variable?
Here I have a text link in a variable to an object in a hash table, for example:
$var = '$ht.key1'
and what should I do to do this?
those. as if I typed this from the keyboard: $ht.key1
Answer the question
In order to leave comments, you need to log in
So?
$date = Get-Date
$command = '$date.dayofyear'
Invoke-Expression $command
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question