How to Save Terminal Commands in Windows Using PowerShell Transcript

Published: (February 2, 2026 at 04:31 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

The Problem

As developers, we often run multiple commands in sequence:

  • Setting up new projects
  • Installing dependencies
  • Running build scripts
  • Deploying applications

Remembering or recreating these exact commands later can be frustrating. Screenshots don’t capture everything, and manually copying commands is tedious and error‑prone.

The Solution: PowerShell Transcript

PowerShell Transcript is a built‑in feature that records everything that happens in your PowerShell session – both the commands you type and their output. It’s like a flight recorder for your terminal!

How to Use PowerShell Transcript

Step 1: Start Recording

Before you begin your work, start the transcript with this command:

Start-Transcript -Path "C:\path\to\commands.txt"

Replace C:\path\to\commands.txt with your desired file location, e.g.:

Start-Transcript -Path "C:\Users\YourName\Desktop\my-session.txt"

You’ll see a confirmation message similar to:

Transcript started, output file is C:\Users\YourName\Desktop\my-session.txt

Step 2: Run Your Commands

Perform all your tasks normally. Every command and its output will be recorded, for example:

cd my-project
npm install
npm run build
git add .

Step 3: Stop Recording

When you’re finished, stop the transcript:

Stop-Transcript

You’ll see:

Transcript stopped, output file is C:\Users\YourName\Desktop\my-session.txt

What Gets Saved?

The transcript file includes:

  • Timestamp of when recording started
  • All commands you typed
  • All output from those commands
  • Error messages, if any occurred
  • Timestamp of when recording ended

Pro Tips

Automatic File Naming

Use timestamps in your filename to organize multiple sessions:

$date = Get-Date -Format "yyyyMMdd_HHmmss"
Start-Transcript -Path "C:\logs\session_$date.txt"

Append to Existing File

Continue recording to the same file across sessions:

Start-Transcript -Path "C:\path\to\commands.txt" -Append
Back to Blog

Related posts

Read more »

Publishing Pipeline - LinkedIn Support

markdown !12ww1160https://media2.dev.to/dynamic/image/width=50,height=50,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuplo...