Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to easily cd to \users\name?

Jul
30
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
 
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
 
I also wish to create an alias to easily cd to my home directory which is \users\xxx\.

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!
 
>
> 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.
>

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.
 
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...

Well, there is @SHFOLDER....
 
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
 
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 I like yours. It's exactly like Linux.

Larryalk
 
From: larryalk
|
Jim Cook said:
|| Also, assuming that your parameter character is &, otherwise change
|| it near the end of the alias
| Jim I like yours. It's exactly like Linux.

To make TCC more like 4DOS, I (and several others) utilize its ability to specify the special characters used by TCC to locate parameters in aliases and batch files, separate compound commands, and to escape characters to be used lieterally, using the characters that are the defaults in 4DOS: &, ^, and ctrl-X, resp. You can do this either in your .INI file (set e.g. by using the Advanced page of the OPTION dialog), or by using the SETDOS command. Note that Jim Cook used them, too!
--
HTH, Steve
 
Back
Top
[FOX] Ultimate Translator
Translate