Quantcast
Channel: PowerShell – FAQforge
Viewing all articles
Browse latest Browse all 26

How to transcript command session in PowerShell

$
0
0

You have often worked with PowerShell commands and scripts and you might want to transcript those commands as well as their outputs as a record or for future reference. While you may also do it by manually copy and paste them in a text file or you can type individual commands to save the input of commands entered in PowerShell.

However, PowerShell simplifies this solution. It let you transcript commands and their outputs of a PowerShell session in a text file.

In this article, I will describe the method using which you can transcript or record the PowerShell session.

In the search bar of windows, type PowerShell and from the results that appear, click on PowerShell.

In the PowerShell command window, type:

Start-Transcript -Path "Desktop\transcript.txt"

PowerShell start transcript

All the commands you have run with their outputs will be saved in the desktop as a text file. You can later view this in notepad.

View transcript file in notepad

Append to an existing file

Adding -append at the end of transcript command allows adding new transcript at the end of an existing file without overwriting.

Add the following command in PowerShell:

Start-Transcript -Path "Desktop\transcript.txt" -append

After entering the above command, now enter the other your everyday commands and scripts.

Append to an existing file

The above command will append the recent commands and their outputs in the existing text file without overwriting it.

Resulting command transcription

Confirm before execution

You can add -confirm parameter after the transcript command. It will ask for confirmation before executing the command.

Start-Transcript -Path "Desktop\transcript.txt" -confirm

Confirm before execution

By following the above method, you can easily transcript the complete session of PowerShell commands and their outputs as a text file in the specified location.

 

The post How to transcript command session in PowerShell appeared first on FAQforge.


Viewing all articles
Browse latest Browse all 26

Trending Articles