Saturday, March 9, 2013

Command Prompts with Date and Time

I spend a lot of time in command prompts and have found it useful to have the date and time associated with a given command. It’s great for comparing “how long does this take” especially after the fact. To add this to your command prompt on Windows 7 (and probably XP and earlier versions), change the PROMPT environment variable ala:

PROMPT=$d $t$_$p$g

I usually set this as a user environment variable. These can be set by typing Start then entering “sys env” (no quotes). The first option should be “Edit the system environment variables”. Add a new user environment variable named PROMPT with the value specified above.

PROMPT syntax is described at the online docs for the prompt command.

While the date and time displayed don’t account for the amount of time it takes to type in the command (with very long commands this can be a few minutes) it’s usually a good indicator.

No comments :

Post a Comment