Jump to content

Recommended Posts

Posted
Hmm didn't know that! All these years I have using the up and down arrow to cycle through the history.

 

Same here - I normally just use the up / down arrow keys and cycle through them that way

 

Never knew about F7 / F8 etc - I'll Be Dammed !!

 

Thanks for this post @DaveP

Posted
I prefer to use Get-history:

 

Get-History | Out-GridView

 

That grid view command is really handy!

 

ls | ogv

 

:eek:

 

Wonder if I can combine this with the SQL and XML functions....

Posted
That grid view command is really handy!

 

ls | ogv

 

:eek:

Wonder if I can combine this with the SQL and XML functions....

 

As long as you're function is using something (Write-output is my go to cmdlet) to return an object containing that data then it should work fine.

Posted

Why would you even need command history, surely we are all crafting our commands carefully and only entering what we need the one time, and if we need something repetitive, well its on the up key!

 

:troll:

  • Thanks 1
Posted (edited)

I've known about this for a little while (inadvertently, when an object fell on my keyboard) and while I do find it useful, I still find myself using the up/down arrow keys and F3 often.

 

Fun fact: This functionality has been available as far back as MS-DOS 5.0 which included the first release of DOSKEY.EXE. However, it's not as nice to use as F7 only lists previous commands and doesn't let you select them. Somehow you're supposed to use doskey to execute those but I haven't yet worked out how.

 

EDIT: Apparently it's F9, which asks for a line number from the F7 list which when inputted then displays that previous command. It's actually worth looking up DOSKEY on Wikipedia as this gives you a whole host of different commands and keys which also apply to the current command prompt.

Edited by MrEprise
Posted

There are a couple of alternative ways to accomplish the same thing. :)

 

When using Windows Explorer navigate to a folder and then in the address bar type "CMD" [without the quotes] and press return to have the Command Prompt to open in the same folder:

Hold down Shift in any Explorer window to see an additional context menu item called "Open command window here".

 

http://vgy.me/y5NXWr.png

 

At the Command Prompt type "Start." [without the quotes] and press return to have Windows Explorer start viewing the folder that the Command Prompt was sitting at when the command was typed:

Although it's a few characters longer you can also type "Explorer ."

 

http://vgy.me/7kbvot.png

Posted

For those that prefer PowerShell to the Command Prompt the script posted below might be useful. Run it once to add an extra item to your context menu called "Open Windows PowerShell here".

 

http://vgy.me/gKIoZp.png

 

# Source: http://www.powershellmagazine.com/2013/06/25/pstip-how-to-start-an-elevated-powershell-from-windows-explorer/

$menu = 'Open Windows PowerShell here'
$command = "$PSHOME\powershell.exe -NoExit -NoProfile -Command ""Set-Location '%V'"""

'directory', 'directory\background', 'drive' | ForEach-Object {
   New-Item -Path "Registry::HKEY_CLASSES_ROOT\$_\shell" -Name runas\command -Force |
   Set-ItemProperty -Name '(default)' -Value $command -PassThru |
   Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru |
   Set-ItemProperty -Name HasLUAShield -Value ''
}

  • Thanks 1
Posted

Another:

 

Add " | clip" [without the quotes] to the end of many DOS/Powershell commands to copy the output directly to the clipboard:

 

http://i.snag.gy/AkLDb.jpg

  • Thanks 3
Posted (edited)

When using Windows Explorer drag a folder over to an open Command Prompt box and it will copy the path of the folder into the box:

 

http://i.snag.gy/1mZaa.jpg

 

Re: Yesterday's 'Clip Tip' You can read the content of a file onto the clipboard:

 

http://i.snag.gy/S8fE2.jpg

 

Edit: If you were to add " && notepad" [without the quotes] it would start notepad ready for you to paste the information on the clipboard:

 

http://i.snag.gy/2v80D.jpg

Edited by 6Foot2
Add detail to the post and correct a typo.
  • 1 year later...
Posted

doskey /history

 

[ATTACH=CONFIG]42117[/ATTACH]

 

Save doskey command history to a text file:

 

doskey /history > C:\Users\name\Desktop\commands.txt

 

[ATTACH=CONFIG]42118[/ATTACH]

 

Result:

 

[ATTACH=CONFIG]42119[/ATTACH]

Posted

doskey /history

 

DOSKEY History.jpg

 

Save doskey command history to a text file:

 

doskey /history > C:\Users\name\Desktop\commands.txt

 

Save DOSKEY History.jpg

 

Result:

 

Saved DOSKEY Command History.jpg

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...