How to easily cd to \users\name?

Jul 18, 2009
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
 
May 20, 2008
3,515
4
Elkridge, MD, USA
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
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,469
88
Albuquerque, NM
prospero.unm.edu
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!
 
May 20, 2008
603
0
Sammamish, WA
>
> 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.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,469
88
Albuquerque, NM
prospero.unm.edu
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....
 
May 20, 2008
3,515
4
Elkridge, MD, USA
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
 
Jul 18, 2009
30
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 I like yours. It's exactly like Linux.

Larryalk
 
May 20, 2008
3,515
4
Elkridge, MD, USA
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
 
Similar threads
Thread starter Title Forum Replies Date
B when doing SFTP via IFTP to my secure site my users always get the finger print key prompt Support 1
jbanaszczyk Users' solutions Support 4
Phileosophos Fixed Register for all users doesn't register for all users Support 10
S How to? Install TCMD for ALL users Support 5
millardjk Register TC13 for all users? Support 12
Joe Caverly How to? Get name of current LIBRARY function? Support 4
vefatica Command name mix-up Support 3
Jay Sage Command Will Not Run Using Short Name of Path Support 5
Chen Touboul When i try to delete an empty folder i got "the dirctoy name is invalid" Support 3
vefatica LIBRARY and file name completion? Support 4
vefatica PLAYSOUND requires 8-dot-3 name? Support 8
R Tree on FAT32 does not sort by name by default. Support 6
vefatica START /PGM "name with spaces.URL" fails Support 2
vefatica Can TCC complete this file name? Support 5
thorntonpg option /u not working The directory name is invalid Support 5
Dmitry L. Kobyakov WAD Start /pgm "name.htm" works improperly Support 4
vefatica Array name in a variable? Support 3
E My echo full file name to the clipboard fails now. Support 2
Joe Caverly @NAME supports library functions Support 2
H file name completion on tcc21.01.61 Support 4
C See if a file name matches extended range. Support 15
vefatica Two @FUNCTIONs/aliases with the same name Support 4
x13 Function to get interface user-defined name? Support 10
nickles Command name parsing of GNU compilers Support 13
M Registered to machine-name? Support 7
P Rename files with ampersand in the name Support 1
mdwyer TCC 13 COPY: specified network name is no longer available. Support 5
R How to? Name completion only of directories? Support 3
I "IF" command in a variable does not expand redirection variable name Support 0
nickles Fixed Executing long command lines in a batch generates file name errors Support 16
Jay Sage Short File Name Won't Execute Support 4
rps Fixed V17 @name adding quote (") to result Support 5
vefatica FFIND /S, find directory with specified name? Support 7
jbanaszczyk Alias with space in the name Support 3
tmaynard Invalid item name "Lua" Support 6
MickeyF how to work with env var with special characters in the name Support 5
nickles WAD Variable name gets changed within FOR loop Support 2
B Why Does @GETDIR Repeat Selected Directory Name In Returned Value Support 7
noahcoad Fixed Can't @iniread a section w quotes in the name Support 6
M A UNC name failure... Support 28
M Why is an obviously invalid file name allowed? Support 2
T TCC reading TCMD.INI causing "Invalid item name" warnings and pauses Support 2
C start /wait /pgm "program name" ^ ketstack n/w Support 3
J Tab-Complete annoyance when directory name and file basename match and tab on '.' Support 1
vefatica START /DESKTOP="name with space" ... Support 4
S WAD PDIR: files with percent sign % in name cause not listing other files in directory Support 9
C sendmail TO name? Support 9
cgunhouse ProcessMonitor Does Not Work With Quoted Process Name Support 5
cgunhouse ProcessMonitor Does Not Work With Quoted Process Name Support 0
D Copy directory tree without repeating directory name Support 32

Similar threads