powershell: how to evaluate a string read from a file

后端 未结 3 741
南旧
南旧 2020-12-31 01:17

file a.txt is:

delete from test_$suffix

$a=get-content a.txt

$suffix=\"tableA\"

how to manipulate the variab

3条回答
  •  星月不相逢
    2020-12-31 02:08

    Invoke-Expression is the equivalent.

    $strExpression = "5 + 5 -eq 10"
    Invoke-Expression $strExpression
    True
    

    See http://technet.microsoft.com/en-us/library/ee176880.aspx for more information.

提交回复
热议问题