how to alias at win2k command prompt?

Discussion in 'Windows Operating Systems' started by Spiff, Aug 13, 2002.

  1. Spiff

    Spiff Member

    Joined:
    Dec 23, 2001
    Messages:
    117
    Location:
    Perth, WhereisOZ
    When i open a command prompt, it's at c:\
    I'd like to be able to type 'cd desktop' and go to the desktop instead of having to type 'cd Docume~1\All Users\Joe\desktop'

    is there a way to alias a particular directory to a word so everytime i change directory, i go straight to the directory?

    cheers,
    Spiff
     
  2. Pseudo

    Pseudo Member

    Joined:
    Jun 28, 2001
    Messages:
    1,377
    Location:
    Melbourne
    Not to my knowledge, but you could make a batch file that executes the change directory command and name it "desktop.bat" or whatever.

    Just place that command into a blank text file, and name it what you choose (with .bat extension). Then to change to your desktop directory you'd type "desktop" (or what you've named it).
    Code:
    [b]desktop.bat[/b]
    [font=arial]‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾[/font]
    C:\
    cd Docume~1\All Users\Joe\desktop
    
    Something like that should work. Oh, you probably should place the batch file somewhere in your command path (type "path" for a list), eg. C:\WINNT - for then it can be accessed from anywhere.
     
  3. commando

    commando Member

    Joined:
    Jul 26, 2001
    Messages:
    4,584
    Location:
    Bankstown, Sydney
    I remember u could do that same thing in DOS,,by adding a "Path=c:\***" to the autoexec.bat
    wonder if it still works?
     
  4. Eimi

    Eimi Member

    Joined:
    Jun 28, 2001
    Messages:
    3,656
    Location:
    Melbourne, VIC
    SUBST [DRIVE1] [DRIVE2]/PATH

    so if you put SUBST X: c:\docume~1\%username%\desktop\

    Then the drive letter X: will be associated with your destop folder
     
  5. Pseudo

    Pseudo Member

    Joined:
    Jun 28, 2001
    Messages:
    1,377
    Location:
    Melbourne
    Ahh, I remember that one now. I use to love optimising my system back in the Doom II -> Win95 (inclusive ;)) days... but I've pretty much forgotten everything handy like that now (probably because it's no longer handy! :)
     
  6. Eimi

    Eimi Member

    Joined:
    Jun 28, 2001
    Messages:
    3,656
    Location:
    Melbourne, VIC
    It still comes in handy for somethings, like setting up local user folders as drives (hence hiding the path), or just making navigating to regular DL folders etc rather than making shortcuts everywhere, mainly because these things really annoy me.'

    I still wish NT command prompt had the alias command from unix, would make doing things like this a whole lot easier
     
    Last edited: Aug 13, 2002
  7. joe_sixpack

    joe_sixpack Member

    Joined:
    Jan 21, 2002
    Messages:
    2,850
    Location:
    Brisbane
    cd %userprofile%\desktop

    or even better.

    set up an user variable called desktop and add the value:
    %userprofile%\desktop

    so you can just type: cd %desktop% from any where.

    one thing about subst is that it needs to be setup every time you reboot your machine - ie. startup folder.

    once the variable is set - its there for good. :cool:
     

Share This Page

Advertisement: