Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

! command

  • 07-04-2005 03:10PM
    #1
    Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭


    In unix shells, you can call previous commands by using !

    For example, if, say 20 commands ago, I ran "thiscommand thisarg1 thisarg1" and I wanted to run it again with the same set of arguments, I'd just type !th <enter> and blammo, it'll search through the command history and run the first thing that starts with "th".

    Is there a similar feature in the windows cmd.exe? Or can I download one?

    Thanks in advance.


Comments

  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 95,993 Mod ✭✭✭✭Capt'n Midnight


    On dos/win 9x you can load DOSKEY in the autoexec AFAIR it has that

    I usually just use the arrow keys and after 20 lines I'd open notepad and make a batch file.

    BTW: to get TAB to step autocomplete file/folder names in NT / 2K
    REGEDIT4
    
    [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
    "EnableExtensions"=dword:00000001
    "DefaultColor"=dword:00000000
    "CompletionChar"=dword:00000009
    


  • Registered Users, Registered Users 2 Posts: 23,202 ✭✭✭✭Tom Dunne


    Or you could just go back to your roots and run bash on Windows.


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    Tom: Tried bash on windows through the cygwin package. TBH I thought it was crip. Trying too hard to make windows into unix. Things like C: <enter> would be nice instead of cd /sysdrive/c/ (or whatever it was).

    Capt'n: I have the autocomplete. Nice feature that. Also, I'm running XP, so no doskey, only the up arrow :(

    I use the command prompt a /lot/ in work and just love the ! functionality in unix shells. May write a program myself to do it. Should be handy enough. Will report back if I do get the finger out. :)

    Thanks anyway lads.


  • Registered Users, Registered Users 2 Posts: 4,003 ✭✭✭rsynnott


    CygWin or MinGW are probably your only readily available options.


  • Closed Accounts Posts: 244 ✭✭osmethod


    For example, if, say 20 commands ago, I ran "thiscommand thisarg1 thisarg1" and I wanted to run it again with the same set of arguments, I'd just type !th <enter> and blammo, it'll search through the command history and run the first thing that starts with "th".

    Is there a similar feature in the windows cmd.exe? Or can I download one?

    Open a command line prompt.
    Type doskey
    perform a few commands...
    Press F9 and you can enter a number e.g 3 this will rerun the 3rd command.

    Also, if you run doskey /history after you've loaded doskey and ran some commands it will list all your commands in sequence.

    osmethod


  • Advertisement
Advertisement