Go Back   The UNIX and Linux Forums > Special Forums > Windows & DOS: Issues & Discussions


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

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-24-2008
Registered User
 
Join Date: Oct 2002
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
Location: /there/is/only/bin/sh
Posts: 3,653
Thanks: 0
Thanked 8 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
Moderator
 
Join Date: Feb 2007
Location: The Netherlands
Posts: 7,500
Thanks: 73
Thanked 473 Times in 452 Posts
Or you can use an ordinairy batch file or a VB script.
    #4  
Old 09-13-2008
Perderabo's Avatar
Unix Daemon (Adminstrator Emeritus)
 
Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,692
Thanks: 27
Thanked 293 Times in 168 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
Registered User
 
Join Date: Sep 2008
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
Registered User
 
Join Date: Jul 2007
Posts: 110
Thanks: 0
Thanked 0 Times in 0 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
Registered User
 
Join Date: Jul 2007
Posts: 110
Thanks: 0
Thanked 0 Times in 0 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 11:12 AM
equivalent ps -C command bobprabhu Solaris 9 06-18-2010 10:02 AM
Need svcs equivalent command EmbedUX UNIX for Advanced & Expert Users 2 10-07-2009 05:57 AM
command that is equivalent to smitty in IBM. oracle_rajesh_k HP-UX 1 11-16-2008 06:33 AM
command that is equivalent to TOPAZ in IBM. oracle_rajesh_k HP-UX 2 11-15-2008 05:03 PM



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