Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Remove Variables on Script Completion

$
0
0

Hi,

Is there a way to remove variables that I create in a script after it has finished running. I have a script with a dozen odd variables which I would like to delete after the script has done its job.

The options I have seen are:

  • Close down the Powershell environment and restart
  • Use Remove-Variable command

If I use get-variable and limit the scope to script I see other variables which I did not define. I would only like to remove the variables which I have defined. 

Any suggestions would be appreciated. 

Regards,

MobileIAm


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>