views:

110

answers:

1

How do I set the command line prompt in Windows to display current ISO 8601 date and time (e.g. 2009-09-08T13:01:56) instead of the default of current directory?

Update. Set it by: right click My Computer/Properties/tab Advanced/Environment Variables/System Variables/New/ Variable name=PROMPT and Variable value=$DT$T $P$G /OK/OK/OK. Regional settings must be set such that "Time format" is "HH:mm:ss" and "Short date format" is "yyyy-MM-dd".

+3  A: 

This will give you the current date and time formatted according to the system regional settings:

prompt $D $T$G

I don't think there is a way to specify the datetime format.

jeroenh
Thanks. How can it be made permanent?
Peter Mortensen
You can do this by creating a global environment variable called PROMPT, with the value '$D $T$G'
jeroenh