Discussion Locked
0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How can I use the current (system)date as a variable in a NT shell script?
1 reply
Hi,
There is no direct access to the date from an NT shell script, but you can access it by doing something like...
date /t > temp.txt
for /F "tokens=2*" %i in (temp.txt) do echo %i
will set the environment variable %i to the date.
Here is an example...
E:\Documents and Settings\Tim Medhurst>date /t > temp.txt
E:\Documents and Settings\Tim Medhurst>for /F "tokens=2*" %i in (temp.txt) do echo %i
E:\Documents and Settings\Tim Medhurst>echo 01/04/2002
01/04/2002
E:\Documents and Settings\Tim Medhurst>
Cheers,
Tim.
This discussion is closed to new replies.
Trending Windows Forum posts
Sort by Trending
0 helpful
10 replies
Question Locked
Do You Save Useful Windows Tutorial Videos for Later
0 helpful
7 replies
0 helpful
1 reply
Question Unanswered
Is WSL still relevant in 2026?
0 helpful
0 replies
0 helpful
2 replies