"global" variable
i have variable :
$x="";
function setx(){
$x=10;
}
setx
write-host $x
it seems value updated in setx local function , not script, how can modify the
script variavle?
and there option explicit in vbscript?
hi,
try use global scope:
new-variable -scope global -name x -value "" function setx(){ $global:x=10; } setx write-host $x
Windows Server > Windows PowerShell
Comments
Post a Comment