On Feb 7, 11:42 am, David Trimboli <
trimb...@cshl.edu> wrote:
> On 1/28/2012 12:47 PM, naugiedoggie wrote:
>
>
>
>
>
>
>
>
>
> > I have a function that requires the user to pass in the name of a
> > hashtable. This is easy if the user just uses the commandline option
> > to specify it, i.e. functionname -modifiers $modifiers, where
> > $modifiers is the name of an existing hash.
>
> > My question is, how can I prompt the user if she fails to provide the
> > required hash name? A prompt of the format like this returns a
> > string, which even though it is the name of the hash variable, is not
> > actually variable reference to it.
>
> > param ([string]$infile,[string]$outfile,[hashtable]$modifiers=$(read-
> > host "Enter the hash name"))
>
> > I tried a few things like, ${(read-host "enter hash name")} but I
> > can't figure out how to get past the fact that read-host returns a
> > string and I can't get from that string to the actual reference
> > variable of the same name.
>
> Why are you asking for a name rather than a reference to the hash table
> itself? MyFunction -HashTable $MyHashTable
>
> PowerShell version 2 introduced metadata attributes for functions. The
> Scripting Guys have a page on it:
Thanks for the reply. I believe that you have provided me with the
information I needed. I am not familiar with the new parameter