Reputation: 106
I'm wondering if there is any way in powershell to run a command without logging it in the history or the up arrow "buffer".
Something similar to the following in bash.
history -d $(history 1) ; ls
Any help is appreciated!
Thank you
Upvotes: 1
Views: 1609
Reputation: 392
You can do a simple Clear-History
to clear the entire history or to clear the most recent entry, you can try Clear-History -Id $((Get-History).Id[-1])
but that will leave that command in the history.
There are other ways to skirt the history, which are well explained here: PowerShell's Clear-History doesn't clear history
However, I have to wonder what practical/ethical use would lead you to need to hide a command in the history to begin with.
Upvotes: 2