what is the DOS equivalent of alias command? | Unix Linux Forums | Windows & DOS: Issues & Discussions

  Go Back    


Windows & DOS: Issues & Discussions All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

what is the DOS equivalent of alias command?

Windows & DOS: Issues & Discussions


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-24-2008
milhan milhan is offline
Registered User
 
Join Date: Oct 2002
Last Activity: 11 December 2012, 10:36 PM EST
Location: /home
Posts: 134
Thanks: 0
Thanked 0 Times in 0 Posts
what is the DOS equivalent of alias command?

how do we create aliases to commands in dos?

thanks
Sponsored Links
    #2  
Old 07-25-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
 
Join Date: Mar 2008
Last Activity: 28 March 2011, 6:41 AM EDT
Location: /there/is/only/bin/sh
Posts: 3,653
Thanks: 0
Thanked 10 Times in 8 Posts
Plain DOS does not have support for aliases. You might want to look at 4dos / 4nt or Cygwin.
Sponsored Links
    #3  
Old 07-25-2008
Franklin52's Avatar
Franklin52 Franklin52 is offline Forum Staff  
Moderator
 
Join Date: Feb 2007
Last Activity: 25 November 2014, 4:53 AM EST
Location: The Netherlands
Posts: 7,720
Thanks: 123
Thanked 538 Times in 508 Posts
Or you can use an ordinairy batch file or a VB script.
    #4  
Old 09-13-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 24 November 2014, 10:48 PM EST
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 438 Times in 261 Posts
Actually, an alias to a command can be done in XP. Using regedit I created a subkey called "cpu-z" in "HKLM\SOFTWARE\Microsoft\CurrentVersion\App Paths" with a value of "C:\Utilities\cpu-z\cpuz.exe". And now when I try to run cpu-z, it works. I can replace the value with a path to any program and that works too. Also batch files work, although a cmd window pops up.

One of several little tricks I learned from battling a recent virus....
Sponsored Links
    #5  
Old 03-22-2009
carlos25 carlos25 is offline
Registered User
 
Join Date: Sep 2008
Last Activity: 3 August 2009, 4:45 PM EDT
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
I know I'm rather late on this but it might help others...

You can use doskey to create an alias on any version of windows up to Windows XP (I'm not sure if it's available on Vista).

Code:
C:> doskey alias_name=command

doskey will only work within the environment that it's invoked in and if you want the aliases to be available every time you start cmd.exe will need to write a script that will load them upon invoking your cmd prompt (cmd /K "My_Environment_Script.bat").

Example:

I often need to change drives and cd doesn't handle it very well but chdir does. However, the length of the command is tiresome to type every time I need it so I do this...

Code:
doskey cdd=chdir /D %1

So when I type:

cdd F:

The command prompt will change to F:>

More information on DosKey can be found here:

DOSKey - Wikipedia, the free encyclopedia
Sponsored Links
    #6  
Old 04-06-2009
ilan ilan is offline
Registered User
 
Join Date: Jul 2007
Last Activity: 14 June 2014, 4:22 PM EDT
Posts: 110
Thanks: 0
Thanked 2 Times in 2 Posts
Carlos, if you are trying to just change teh drives, you can simply type drive letter as in below...


C:\Documents and Settings\ilango>f:

F:\>e:

E:\>h:

H:\>c:

C:\Documents and Settings\ilango>

/ilan

PS: ignore my comments if you are just you used this an example in your comment!!
Sponsored Links
    #7  
Old 04-06-2009
ilan ilan is offline
Registered User
 
Join Date: Jul 2007
Last Activity: 14 June 2014, 4:22 PM EDT
Posts: 110
Thanks: 0
Thanked 2 Times in 2 Posts
Hello Milhan,

on top of what Pederabo has suggested.., the oter easy way to get working similar to aliases are using a set command..


C:\Documents and Settings\ilango\test>set dira=dir /A

C:\Documents and Settings\ilango\test>dir
Volume in drive C has no label.
Volume Serial Number is 548F-C2AD

Directory of C:\Documents and Settings\ilango\test

04/06/2009 12:13 PM <DIR> .
04/06/2009 12:13 PM <DIR> ..
04/06/2009 12:13 PM 4 normal.txt
1 File(s) 4 bytes
2 Dir(s) 6,269,435,904 bytes free

C:\Documents and Settings\ilango\test>%dira%
Volume in drive C has no label.
Volume Serial Number is 548F-C2AD

Directory of C:\Documents and Settings\ilango\test

04/06/2009 12:13 PM <DIR> .
04/06/2009 12:13 PM <DIR> ..
04/06/2009 12:13 PM 4 hidden.txt
04/06/2009 12:13 PM 4 normal.txt
2 File(s) 8 bytes
2 Dir(s) 6,269,403,136 bytes free

C:\Documents and Settings\ilango\test>


In teh above example, i made simiar to alias - dira to be executed as dir /A, only thing is you will have to use it with percentages.. as in %dira%

/ilan
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
smitty equivalent command line command asyed123 AIX 2 09-24-2011 12:12 PM
equivalent ps -C command bobprabhu Solaris 9 06-18-2010 11:02 AM
Need svcs equivalent command EmbedUX UNIX for Advanced & Expert Users 2 10-07-2009 06:57 AM
command that is equivalent to smitty in IBM. oracle_rajesh_k HP-UX 1 11-16-2008 07:33 AM
command that is equivalent to TOPAZ in IBM. oracle_rajesh_k HP-UX 2 11-15-2008 06:03 PM



All times are GMT -4. The time now is 08:06 PM.