file a.txt is:
delete from test_$suffix
$a=get-content a.txt
$suffix="tableA"
how to manipulate the variable to set it as
delete from test_tableA
To check to see if one object is equal to another object in PowerShell is done using the eq operator. The eq operator compares simple objects of many types such as strings, boolean values, integers and so on. When used, the eq operator will either return a boolean True or False value depending on the result.
To find a string inside of a string with PowerShell, you can use the Substring() method. This method is found on every string object in PowerShell. The first argument to pass to the Substring() method is the position of the leftmost character.
If you want to know in PowerShell if a string contains a particular string or word then you will need to use the -like operator or the . contains() function. The contains operator can only be used on objects or arrays just like its syntactic counterpart -in and -notin .
PowerShell has another option that is easier. You can specify your variables directly in the strings. $message = "Hello, $first $last." The type of quotes you use around the string makes a difference.
$a=get-content a.txt $suffix="tableA" $ExecutionContext.InvokeCommand.ExpandString($a)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With