function var {
[cmdletbindings]
param(
[sting] $ss="M:\mypath",
[hash] $hashtable=@{},
[path]$mypath,
[string]folder,
[sting]$fullpath= join-path $ss -childpath $folder
[string]$branch ='master'
)
$a={
ss=$($ss)
fullpath=$($fullpath)
hashtable=$($hashtable)
branch=$($branch)
mypath=$($mypath)
}
return $a
}
In case when I try to pass $a.branch say in below command
git pull origin '$a.branch' >>* $a.fullpath (its not working, without '' quotes also gives err)[gives exception and exit]
In general if I declare varible as $name='master' locally and pass in same command then its working fine
I observed when I convert any variable in PSobject or PScustomobject and even using out-string to convert into string and pass its not getting executed at all while passing any function
example 2
function var{
[cmdletbindings]
param(
[sting] $ss="M:\mypath",
[hash] $hashtable=@{},
[path]$mypath,
[string]folder,
[sting]$fullpath= join-path $ss -childpath $folder
[string]$branch ='master'
)
return $hashtable,$branch,$fullpath
}
$m=var
$m[0], $m[1], m[2] -- I can get params in array but how to get them more readable
like instead 0,1,2 I want something like $m['hastable'], m['branch'] or $hash=$m[0] like this in output
here I create a module and now I want to declare all variable in single file .json or .ps1 or any text file and want to import in my individual script but getting type casting error so doing above exercise