LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 11-03-2004, 06:13 PM   #1
servnov
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2
Posts: 276

Rep: Reputation: 30
How to make alias of 'ls' in winxp/dos


I would like to alias 'dir' as 'ls' in winxp. First of all dir is more like ls -l so what argument can I give to dir to be similar to ls...I want to then alias that, since I find myself always typing 'ls' :-P
 
Old 11-03-2004, 06:32 PM   #2
Thymox
Senior Member
 
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Mostly Debian based systems
Posts: 4,368

Rep: Reputation: 64
You could install Cygwin onto Windows and have a full BASH environment instead! Seriously, if you install Cygwin and add the Cygwin 'bin' folder to your Windows PATH environment variable you should be able to type ls at a dos prompt and it'll actually run ls proper. Certainly this is what I used to do in Windows.
 
Old 11-04-2004, 01:40 AM   #3
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
The easiest way to give any alias in DOS/Windows is to create a batch file,

1. Give your filename as ls.bat
2. Give the command dir in the batch file.
3. Put ls.bat in a directory that is in the PATH.

Then you can type ls instead of dir.

As simple as that.
 
Old 11-04-2004, 04:47 PM   #4
servnov
Member
 
Registered: Sep 2004
Distribution: Slackware 10.2
Posts: 276

Original Poster
Rep: Reputation: 30
Thanks man, this is awesome. I found 'dir /b' to be much like 'ls' and made a bat file for it. I made a few more also . I even used the good old DOS 'edit' to make some. I didn't think win32 could be so cool.

Are there some other good tricks you know? How can I make variables in command line (the $ in unix)?
 
Old 11-04-2004, 08:39 PM   #5
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
I think you can use the SET command or similar in DOS to create environment variables. But since it's such a long time since I used DOS, I'm not sure. You should verify with somebody who knows.

And glad I could be of help
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I make an alias? quintan Linux - Software 2 11-25-2005 03:44 AM
alias cs='cd $1; ls' milanche Linux - Newbie 11 09-13-2005 05:57 PM
How to make an alias? Gins Linux - General 6 06-06-2005 07:13 PM
make an alias in winXP zchoyt Linux - General 2 09-14-2004 08:33 AM
WinXP fixmbr = DOS fdisk /mbr WhatsHisName Linux - General 4 05-06-2004 05:53 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 11:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration