1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to easily cd to \users\name?

Discussion in 'Support' started by larryalk, Nov 17, 2010.

  1. larryalk

    Joined:
    Jul 18, 2009
    Messages:
    30
    Likes Received:
    0
    I'm new to tcmd although used 4dos and 4nt for many years. To get started I need to recreate my old aliases (many) which probably have a different syntax now.

    Are there any lists of common aliases?
    Particularly dir aliases to select the last created file, display dirs only, sort files by size, by extension etc.

    I also wish to create an alias to easily cd to my home directory which is \users\xxx\.
    I'm used to Linux where you just issue cd and that takes you to your home directory.

    Thanks for any help,
    larryalk
     
  2. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    646
    Likes Received:
    1
    Did you try them? Maybe they still work.

    dir /od /t:c

    dir /a:d

    dir /os

    dir /oe

    cd \users\xxx\
     
  3. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    From: larryalk
    | I'm new to tcmd although used 4dos and 4nt for many years. To get
    | started I need to recreate my old aliases (many) which probably have
    | a different syntax now.
    Unlike Microsoft, JPsoft maintains backward compatibility to the maximum possible extent. Only when an old feature is no longer supported by the OS (and cannot easily emulated in TCC) is it dropped. For example, the OS does not support the concept of a "current directory" for each drive (only for the current drive). TCC does support it (though only on a per-instance basis, so two concurrent instances of TCC could have different default directories for the same drive). Many of my aliases originated from 4DOS, though improved capabilities often resulted in changes, mostly simplifications. I dropped many, because the feature they created is now internal.|
    | Are there any lists of common aliases?
    No.
    | Particularly dir aliases to select the last created file, display
    | dirs only, sort files by size, by extension etc.
    Unsorted order for NTFS drives is by name. Default time displayed is modification time, which is often different from creation time for files that were creadeted by copying another file, edited in place, appended to, etc., and is generally more meaningful than creation time. Note that unlike Unix and its imitators, by default the copy of a file retains the original file's modification time (but has a new creation time). Sorting by various criteria is trivial, using the /O[rder] option, so only if you want to use 2-letter commands is it worth creating aliases. Below is an alias to display the "last created" file in the current directory (UNTESTED!!!):

    alias lastfile=`*dir/tc/o-d | head /n1`

    | I also wish to create an alias to easily cd to my home directory
    | which is \users\xxx\.
    | I'm used to Linux where you just issue cd and that takes you to your
    | home directory.

    alias home=`*cdd/n %userprofile`

    You could also define a similar command to access the "All Users" directory, and some subdirectories of each, e.g., "Application Data", Desktop, "Start Menu". Note that I am using WinXP terminology; if you use a different release of Windows, you may need to change to match it. Ah, what one would give for backward compatibility! It is diametrically opposed to what appears to the public to be the Microsoft philosophy: change everything, so the user would need to buy new software for each new computer...
    --
    HTH, Steve
     
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    I like to create a directory alias:

    Code:
    alias user:=`%userprofile\`
    
    You can use it by itself to change the directory, i.e. type USER: at the command prompt to go to that location. But you can also use it in filenames in any internal command, e.g. DIR USER:DESKTOP to list the contents of your desktop directory. Filename completion also works with directory aliases: type DIR USER:DESK and press Tab, TCC will fill in the first matching filename (usually DESKTOP.)

    A directory alias should have a multiletter name ending with a colon, like USER: or HOME: or PROGS:

    There's a trick that 4DOS didn't know!
     
  5. Jim Cook

    Joined:
    May 20, 2008
    Messages:
    605
    Likes Received:
    0
    Assuming that you want 'cd foo' to go to foo, but 'cd' by itself to go to
    \users\xxx, then you could use this:

    alias cd `if '%1'=='' (cd \users\xxx) else (*cd %&)`

    Also, assuming that your parameter character is &, otherwise change it near
    the end of the alias

    --
    Jim Cook
    2010 Sundays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
    Next year they're Monday.
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,277
    Likes Received:
    38
    Well, there is @SHFOLDER....
     
  7. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    From: Charles Dye
    | Quote:
    | Originally Posted by Steve F�bi�n
    || You could also define a similar command to access the "All Users"
    || directory, and some subdirectories of each, e.g., "Application Data",
    || Desktop, "Start Menu". Note that I am using WinXP terminology; if you
    || use a different release of Windows, you may need to change to match
    || it.
    |
    | Well, there is @SHFOLDER....

    ... which will get you the OS version specific paths of the various important directories, but you need to know the "magic numbers" it uses; I listed actual (WinXP) names so the OP could recognize what I meant. Yes, the @SHFOLDER function could easily be used in the ALIAS definitions to make the more portable. Sorely missing from @SHFOLDER are "quick launch" and "system tray".
    --
    Steve
     
  8. larryalk

    Joined:
    Jul 18, 2009
    Messages:
    30
    Likes Received:
    0
     
  9. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    From: larryalk
    |
     

Share This Page