Start-Transcript
Published: February 29, 2012
Updated: August 15, 2012
Applies To: Windows PowerShell 2.0, Windows PowerShell 3.0
Start-Transcript
Syntax
Parameter Set: ByPath Start-Transcript [[-Path] <String> ] [-Append] [-Force] [-NoClobber] [-Confirm] [-WhatIf] [ <CommonParameters>] Parameter Set: ByLiteralPath Start-Transcript [[-LiteralPath] <String> ] [-Append] [-Force] [-NoClobber] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Start-Transcript cmdlet creates a record of all or part of a Windows PowerShell session in a text file. The transcript includes all command that the user types and all output that appears on the console.
Parameters
-Append
Adds the new transcript to the end of an existing file. Use the Path parameter to specify the file.
|
Aliases |
none |
|
Required? |
false |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-Force
Allows the cmdlet to append the transcript to an existing read-only file. When used on a read-only file, the cmdlet changes the file permission to read-write. Even using the Force parameter, the cmdlet cannot override security restrictions.
|
Aliases |
none |
|
Required? |
false |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-NoClobber
Will not overwrite (replace the contents) of an existing file. By default, if a transcript file exists in the specified path, Start-Transcript overwrites the file without warning.
|
Aliases |
NoOverwrite |
|
Required? |
false |
|
Position? |
named |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-Path<String>
Specifies a location for the transcript file. Enter a path to a .txt file. Wildcards are not permitted.
If you do not specify a path, Start-Transcript uses the path in the value of the $Transcript global variable. If you have not created this variable, Start-Transcript stores the transcripts in the $Home\My Documents directory as \PowerShell_transcript.<time-stamp>.txt files.
If any of the directories in the path do not exist, the command fails.
|
Aliases |
none |
|
Required? |
false |
|
Position? |
1 |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-LiteralPath<String>
Specifies a location for the transcript file. Unlike Path, the value of the LiteralPath parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.
|
Aliases |
none |
|
Required? |
false |
|
Position? |
1 |
|
Default Value |
none |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
|
Required? |
false |
|
Position? |
named |
|
Default Value |
false |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
|
Required? |
false |
|
Position? |
named |
|
Default Value |
false |
|
Accept Pipeline Input? |
false |
|
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
-
None
You cannot pipe objects to this cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
-
System.String
Start-Transcript returns a string that contains a confirmation message and the path to the output file.
Notes
-
To stop a transcript, use the Stop-Transcript cmdlet.
To record an entire session, add the Start-Transcript command to your profile. For more information, see about_Profiles.
Examples
-------------------------- EXAMPLE 1 --------------------------
This command starts a transcript in the default file location.
PS C:\> start-transcript
-------------------------- EXAMPLE 2 --------------------------
This command starts a transcript in the Transcript0.txt file in C:\transcripts. The NoClobber parameter prevents any existing files from being overwritten. If the Transcript0.txt file already exists, the command fails.
PS C:\> start-transcript -path c:\transcripts\transcript0.txt -noclobber
Related topics