# How to Output a Powershell to a Text File

Save

Powershell provides Windows administrators and software developers with a way to automate services, create scripts and send commands to a database server. You can output results of your Powershell commands to a text file. This lets you have a log of results that you can later review to analyze any performance issues on a computer. It's also beneficial if you have a large amount of results, so you can review it later in the day.

• Click the Windows "Start" button and select "All Programs." Click "Accessories" and click the "Windows Powershell" directory. Click the "Powershell" icon to open the utility.

• Set a variable that contains a file name for the output. You must specify a directory path and file name for the output file. Type the following code to create a file variable:

$File ="C:\text.txt This variable sets the output file to "text.txt" that's placed in the root directory. • Type the command you want to use to create the results and use the output file variable. For instance, if you want to create a list of services running on the computer type the following code in Powershell: Get-Service | Out-File$File -append

• Click the Windows "Start" button after the Powershell command completes execution. Click "Computer" and double-click through the directories until you reach the one that contains the output text file. Double-click the file to open it and review the results of the Powershell command.

## References

Promoted By Zergnet

## Related Searches

Check It Out

### Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.