The Sandbox Thread

9 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

DOS versions of: alias, cat, cp, ls, mv, rm, xargs - and desktop.bat

Back to Forum: The Sandbox
  • User profile image
    Maurits

    Do you work at a Linux | UNIX shell, and also at a DOS prompt?

    Are you always typing in "ls" only to get:
    'ls' is not recognized as an internal or external command, operable program or batch file.

    Well, now you can!
    Requirements: some kind of DOS-like command line

    Save the attached file
    Extract the .bat files to your path

    I like to have a C:\custom-path folder rather than throwing everything in system32

    As a bonus I give you desktop.bat which allows you to CD to your desktop with just eight keystrokes (including the Enter key)

    EDIT 10/3/2005: added
    alias
    cat
    rm
    xargs

    EDIT: 4/3/2006:
    modified alias to display list of current aliases if called w/o arguments
    added wordpad

  • User profile image
    SvendTofte

    http://unxutils.sourceforge.net will also do most. native builds for win32, so no strange cygwin dependencies. the ls that ships above doesn't do colours, however this one does: http://utools.com/msls.htm just fyi

  • User profile image
    staceyw

    You can also use MSH (microsoft shell) and just create an alias or function.  Naturally, you need to wait for MSH or get the beta.

  • User profile image
    Maurits

    I had toyed with the idea of creating an alias.bat - something like

    @echo off
    rem alias.bat
    
    rem capture name of alias
    
    set tofile=%1
    echo @echo off > C:\custom-path\%tofile%.bat
    shift
    
    rem build target command
    
    set thecommand=%1
    
    :CONTINUEBUILDING
    shift
    if (%1) == () goto DONEBUILDING
    set thecommand=%thecommand% %1
    goto CONTINUEBUILDING
    :DONEBUILDING
    
    echo %thecommand% %%* >> C:\custom-path\%tofile%.bat
    
    


    but I thought this would be rather dangerous.

    EDIT: for example:
    C:\>alias rm del
    would create a "rm for DOS"

    EDIT2: what the heck... typed in one that works (no sanity checking so be careful!)

  • User profile image
    jachymko

    have you tried doskey.exe ?

  • User profile image
    Maurits

    Bump - added
    alias
    cat
    rm
    xargs

  • User profile image
    Quang

    Get cygwin from www.cygwin.com

    Oh, did you say DOS version or Windows?

  • User profile image
    ActionScribe

    SvendTofte said:
    http://unxutils.sourceforge.net will also do most. native builds for win32, so no strange cygwin dependencies. the ls that ships above doesn't do colours, however this one does: http://utools.com/msls.htm just fyi
    How does http://unxutils.sourceforge.net compare to GnuWin32, in your opinion?

  • User profile image
    rramyaa

    Thanks, great solution.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.