
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Backup Environment Variables Using PowerShell
Sometimes changes in the Windows environment variable can be deadly because it saves information about user profiles, application information, and OS information. It is always better to keep the Environment backup handy and update that file whenever there are any changes or at the regular interval.
Taking up the environment variables backup is easy. To retrieve the environment variable list we can use the below command,
Get-ChildItem env:
To store the environment variable, we can use the Out-File command with text file but if the particular environment variable length is larger enough then we can’t store it in the text file properly.Instead, we can use its specific Key and Value property and store it in the CSV file as shown below.
Get-ChildItem env: | Select Key,Value | Export-Csv C:\Temp\envvariables.csv - NoTypeInformation
The above command will store the Environment variables output to the CSV file at the C:\temp location and the file name would be envvariables.csv.