All Things Microsoft > Microsoft Software

dos aliases?

<< < (2/4) > >>

voidmain:
But he didn't want to change the name of the command, he wanted to change what the command did. So changing "dir" to "sux" won't help him.  He wants to be able to type "cd" and have it run a different command or batch file altogether.  If it were an external command (FORMAT, FDISK, etc) then that would be easy, just rename the command and insert your trojan, but since he asked for a COMMAND.COM internal command you can't do that without replacing the COMMAND.COM with another version that does something entirely different.  Replacing COMMAND.COM would be your answer by the way.

saddlemagic:
Thinking, thinking, thinking... That's right...

Yeah, what he needs is something to intercept the command before command.com sees it.

Wouldn't DIR.BAT be run before DIR, if DIR.BAT was in the the directory you initiated the command from?

I can't do that on this machine but to write a quick batch file named DIR.BAT that does anything but the directory command. Then type DIR from the directory it's in to see if that works.

I'm wingin' it here.

beltorak0:
well, you can edit command.com to change the internal commands to something else, then create batch files for the standard names. use "attr +s +h +r cd.bat" or whatever.  You still have to edit command.com because by default dos searches thru the kernel before the path.  same with device drivers before files.

-t.

[ August 02, 2002: Message edited by: beltorak0 ]

saddlemagic:
Yep, I just barked up that tree and the bark didn't change flavor. Back to the drawing board.

My DOS is getting rusty.

voidmain:
Yes, internal commands are performed first no matter what. And COMMAND.COM is not the kernel, it is a shell, equivelant to bash, ksh, csh, sh in UNIX. I'm not sure how easy it is to replace COMMAND.COM with another shell on Win9x, but in NT it's pretty easy to replace CMD.EXE with the windows version of "bash" or "ksh". That oughtta throw em for a loop.

In Win9x and below it would probably go something like:

SET COMSPEC=C:\BASH.EXE

in the AUTOEXEC.BAT or

SHELL=C:\BASH.EXE

in the CONFIG.SYS but I'm not going fire up Winblows to find out...

Of course remember that COMMAND.COM is also responsible for executing *.BAT files. Bash would not be able to execute batch files but would be able to execute Bash scripts.

[ August 02, 2002: Message edited by: VoidMain ]

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version