Automatic variable definition


hi gurus, 

so not looking powershell automatic variable usage, way can automatically name variables. example, if have text file following contents,

pi=3.14159292  height=4  width=14

i need powershell script automatically define following variables in script these values

$pi=3.1415292  $height=4  $width=14

any suggestion helpful...


-pranav

$vars = get-content vars.txt $varhash = $vars | convertfrom-stringdata ($i=0;$i -lt $varhash.count;$i++) {     new-variable -name ($varhash.item($i).keys) -value ($varhash.item($i))     } 


grant ward, a.k.a. bigteddy

what's new in powershell 3.0 (technet wiki)



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file