Welcome to Powergui.org - an open source community for Windows Powershell

PowerGUI.org PowerGUI.org and blogs

Forums » Request a Script

Thread: how to with variable

This question is answered. Helpful answers available: 2. Answered answers available: 1.


Permlink Replies: 2 - Pages: 1 - Last Post: Aug 13, 2009 5:38 AM by: arenas
arenas

Posts: 3
Registered: 8/13/09
how to with variable
Posted: Aug 13, 2009 1:21 AM
 
  Click to reply to this thread Reply

hi community :)

pls how i have to do, do manipule any variable ?
my idee is:

close all
close all $*like
close $*like

save all (to file)
save all $*like "
save $*like "

restore all (from file)
restore all $*like "
restore $*like "

delet all
delet all $*like
delet $*like

thx for any help
arenas


hugopeeters


Posts: 22
Registered: 5/27/09
Re: how to with variable
Posted: Aug 13, 2009 4:52 AM   in response to: arenas
 
  Click to reply to this thread Reply

It's not completely clear what you mean. You wan't to store, clear and retrieve variables?

You can store the contents of a variable as a file using:
$MyVar | Export-CliXml -Path "d:\scripts\myvar.xml"

And to retrieve it use:
$mynewvar = Import-CliXml -Path "d:\scripts\myvar.xml"

Clear a variable from your session using:
Clear-Variable MyVar #Note no dollar sing!

Hope this helps
Hugo
www.peetersonline.nl


arenas

Posts: 3
Registered: 8/13/09
Re: how to with variable
Posted: Aug 13, 2009 5:38 AM   in response to: hugopeeters
 
  Click to reply to this thread Reply

hello hugo :)

many thx.
now i feel me better !

ps :

restore variable and retrieve variable are only for 1 or global ?
so i have to creat for each variable en XML file ?
and to extract the variable wath i need ?
but not in series $.1, $..1, $...1 ?

can i ad also new variable ?
or i have to creat an new XML file?

the clear option :
the individuelle clear option is okay for me now !

and for the final clear option :
i have contflicte wenth i have moor then 2 script open
i have to use, clear (?)
after the output file (last script-line, befor i clos the file ?)

i m so sorry. all my gestion, gestion, gestion ....
german is better for me.

thnx arenas



Legend
MVP: 2501 + pts
Guru: 2001 - 2500 pts
Expert: 751 - 2000 pts
Enthusiast: 31 - 750 pts
Novice: 0 - 30 pts
Moderators
Helpful answer (5 pts)
Answered (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums