A Digital Age Deserves A Digital Leader

Change The Color Of The Command Prompt Window

Postby Weaver » Fri Nov 22, 2002 11:48 pm

As long as we are on the topic of cool things to do at a command line. Here is a little trick I played on the sytem administrator of the campus I used to attend. He was a die-hard microsoft guy, in fact the whole campus was. They wouldn't allow me to put a linux box anywhere on the campus. They called it a security threat. I had to laugh in their faces at that remark...

Anyways, this trick involves some knowledge of windows but here goes.

First set the priority of batch (.bat) files above that of executable (.exe) files. So when windows checks a directory for a program to run, it will execute the batch script before the executable. This is actually the hardest part to do.

Secondly, the fun part. We created a file called CMD.bat in his system32 directory. Basically all the batch file did was spawn a real CMD window and then change the prompt.

We changed the prompt to C:\My P0rn>

No matter what you do, the prompt stays at C:\My P0rn> Usually when you exit out of cmd and spawn a new one, defaults are restored. But since the batch file supercedes the executable, he was screwed. For a big sysadmin, he sure got schooled by a couple of "linux users", as he called us.

The command to change the prompt is actually "prompt" followed by arguments. In our case, the command was "prompt C:\My P0rn$G" Experiment, and have fun...

-Weaver
Public Keys

The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change.
-- FORTRAN manual for Xerox Computers
PROfessional Member
User avatar
Posts: 1967
Joined: Wed Jun 19, 2002 12:05 am
Location: /home/weaver/

Previous

Return to Guides

Who is online

Users browsing this forum: No registered users and 8 guests