How I can create own driver for variables in powershell

75 views Asked by At

I whant to create driver for own variables in own scope.
For example $myown:name = value

I tried to do that with different values for -Root:

New-PSDrive -Name myown -PSProvider Variable -Root /myown/

But that driver works like variable:.

compare (ls myown:) (ls variable:)
# no changes

How to create psdriver for variables that will work not like variable: psdrive?

$variable:name and $myown:name must be different.

Edited1:

What I want to do

I'm going to create module for loading WPF forms from .xaml.
And all elements with x:Name property must be imported to new PSDriver named like loaded form.

Load-WPF form1.xaml -OutVariable form1
$form1 # loaded WPF form
# and all form's elements added to form1: provider
$form1:button1  # <Button  x:Name="button1"  ../>
$form1:textbox1 # <TextBox x:Name="textbox1" ../>
0

There are 0 answers