Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.os.windows-11 > #18236

Re: Powershell coolness - persistent history

From Char Jackson <none@none.invalid>
Newsgroups alt.comp.os.windows-11
Subject Re: Powershell coolness - persistent history
Message-ID <8dbtuj5l6ijs38jt0f1sgdfppqqn7acmc8@4ax.com> (permalink)
References <349sujhep1jq6869irrt9hmb2l8oh0kpho@4ax.com> <vslje4$9i3h$1@dont-email.me>
Organization Newshosting.com - Highest quality at a great price! www.newshosting.com
Date 2025-04-03 10:51 -0500

Show all headers | View raw


On Thu, 3 Apr 2025 05:12:36 -0400, Paul <nospam@needed.invalid> wrote:

>On Thu, 4/3/2025 2:28 AM, Char Jackson wrote:
>> I very rarely use powershell and I'm not overly familiar with it, but
>> today I wanted to run a command that I knew I had run several months
>> ago. I couldn't remember the syntax, but it turns out that powershell
>> keeps a record of every command I've ever used.
>> 
>> To retrieve the PS command history and display it in Notepad:
>> 
>>    Notepad (Get-PSReadLineOption).HistorySavePath
>> 
>> To find the history file:
>> 
>>    (Get-PSReadLineOption).HistorySavePath
>> 
>> or in File Explorer's location bar:
>> 
>>    %APPDATA%\Microsoft\Windows\PowerShell\PSReadLine\
>>    %APPDATA%\Microsoft\Windows\PowerShell\PSReadLine\*_history.txt
>> 
>> Mine is in:
>> C:\Users\[user]\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
>> 
>> 
>> Probably old news to most folks here, but new news to me.
>> 
>
>You can use the up-arrow key and work back through the history buffer.

For me, that only shows what happened in the current session. I needed a
command from about December or maybe November of last year, which
fortunately was stored in the persistent history file. Like VanguardLH
said, it would be nice if there were date stamps, but I use PS so
infrequently that it wasn't a problem to manually skim through the
history to find what I needed.

>Powershell also has tab-completion, if you type part of a
>command name, then tab tab tab, it will show you all the
>things you could finish up with that spell like that.
>
>These are patterns that are copied on purpose, from
>previous environments. They are like "comfort food"
>for the user.

Back to alt.comp.os.windows-11 | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Powershell coolness - persistent history Char Jackson <none@none.invalid> - 2025-04-03 01:28 -0500
  Re: Powershell coolness - persistent history Paul <nospam@needed.invalid> - 2025-04-03 05:12 -0400
    Re: Powershell coolness - persistent history Andy Burns <usenet@andyburns.uk> - 2025-04-03 10:31 +0100
    Re: Powershell coolness - persistent history Char Jackson <none@none.invalid> - 2025-04-03 10:51 -0500
  Re: Powershell coolness - persistent history VanguardLH <V@nguard.LH> - 2025-04-03 05:40 -0500
    Re: Powershell coolness - persistent history Andy Burns <usenet@andyburns.uk> - 2025-04-03 12:44 +0100

csiph-web