On Home windows 11 and 10, the flexibility to save lots of the Command Immediate or PowerShell command output to a textual content file could be useful in lots of conditions. As an example, exporting the command output for evaluation is handy for troubleshooting an issue. You may as well print the return of a command to a textual content file to save lots of a configuration for documentation functions and extra.
You may at all times choose and right-click the content material to repeat the output to the clipboard and paste it to a textual content file. Nonetheless, the strategy requires extra steps, which you’ll be able to keep away from with a single command utilizing the redirected output to the file perform.
This information will stroll you thru the steps to save lots of the command output to a textual content file on Command Immediate or PowerShell on Home windows 11. (The directions may even work on Home windows 10.)
Learn how to save command output to file utilizing Command Immediate
To avoid wasting the command output to a textual content file with Command Immediate, use these steps:
- Open Begin.
- Seek for Command Immediate.
- Proper-click the highest outcome and choose the Run as administrator possibility.
- Sort the next command to save lots of the output to a textual content file and press Enter: YOUR-COMMAND > C:PATHTOFOLDEROUTPUT.txt
Within the command, change “YOUR-COMMAND” together with your command and “c:PATHTOFOLDEROUTPUT.txt” with the trail and file identify to retailer the output.Â
This instance exports the system technical specs to the “laptop_tech_specs.txt” file: systeminfo > C:laptop_tech_specs.txt
- (Optionally available) Sort the next command to save lots of the output and look at outcomes on the display and press Enter: YOUR-COMMAND > C:PATHTOFOLDEROUTPUT.txt | sort C:PATHTOFOLDEROUTPUT.txt
Within the command, change “YOUR-COMMAND” together with your command and “c:PATHTOFOLDEROUTPUT.txt” with the trail and filename to retailer and look at the output.Â
This instance exports the system technical specs to the “laptop_tech_specs.txt” file and prints the knowledge on the display: systeminfo > C:laptop_tech_specs.txt | sort C:laptop_tech_specs.txt
- Fast tip: In case you have issues viewing the file, you should utilize the sort c:PATHTOFOLDEROUTPUT.txt command after step No. 3.
When you full the steps, the command output will probably be saved into the textual content file, which you’ll be able to assessment or share with tech assist.
Learn how to save command output to file utilizing PowerShell
To avoid wasting the command output to a textual content file with PowerShell on Home windows 11 or Home windows 10, use these steps:
- Open Begin.
- Seek for PowerShell.
- Proper-click the highest outcome and choose the Run as administrator possibility.
- Sort the next command to save lots of the output to a textual content file and press Enter: YOUR-COMMAND | Out-File -FilePath C:PATHTOFOLDEROUTPUT.txt
Within the command, change “YOUR-COMMAND” together with your command and “c:PATHTOFOLDEROUTPUT.txt” with the trail and file identify to retailer the output.
This instance exports the IP deal with configuration to the “laptop_network_settings.txt” file: ipconfig | Out-File -FilePath C:laptop_network_settings.txt
- (Optionally available) Sort the next command to view the saved output on the display and press Enter: Get-Content material -Path C:PATHTOFOLDEROUTPUT.txt
Within the command, change “c:PATHTOFOLDEROUTPUT.txt” with the trail and file identify with the output content material.Â
This instance reveals the contents of the “laptop_network_settings.txt” file: Get-Content material -Path C:laptop_network_settings.txt
After you full the steps, PowerShell will save the outcome right into a textual content file in your specified location.
Extra Home windows sources
For extra useful articles, protection, and solutions to frequent questions on Home windows 10 and Home windows 11, go to the next sources: