A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows 7 » Windows 7 Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

there is a system variable %DATE% that i have used in win 7. I can't find it.



 
 
Thread Tools Rate Thread Display Modes
  #16  
Old March 6th 19, 05:26 PM posted to alt.windows7.general
No_Name
external usenet poster
 
Posts: 21
Default there is a system variable %DATE% that i have used in win 7. I can't find it.

On Tue, 5 Mar 2019 20:40:52 -0800, T wrote:

On 3/5/19 7:58 PM, wrote:
there is a system variable %DATE% that i have used in win 7. it does not show up in command SET that
i can see.

It should be in the parent environment set......I think.

At a cmdline prompt you can type "echo %DATE%"

Where could it be?


Hi Jack,

Are you confusing the date program with a variable?

date /t
Tue 03/05/2019

There is one for time too

-T


date /?
Displays or sets the date.

DATE [/T | date]

Type DATE without parameters to display the current date setting
and a prompt for a new one. Press ENTER to keep the same date.

If Command Extensions are enabled the DATE command supports
the /T switch which tells the command to just output the
current date, without prompting for a new date.


"command extensions" was new to me. Thanks
..

Ads
  #17  
Old March 6th 19, 06:07 PM posted to alt.windows7.general
Char Jackson
external usenet poster
 
Posts: 10,449
Default there is a system variable %DATE% that i have used in win 7. I can't find it.

On Wed, 06 Mar 2019 12:00:11 -0500, wrote:

On Tue, 05 Mar 2019 23:44:58 -0500, Paul wrote:

wrote:
there is a system variable %DATE% that i have used in win 7. it does not show up in command SET that
i can see.

It should be in the parent environment set......I think.

At a cmdline prompt you can type "echo %DATE%"

Where could it be?


Near the bottom. No idea what it means.

https://ss64.com/nt/syntax-variables.html

"If Command Extensions are disabled, the following
dynamic variables will be not accessible:

%CD% %DATE% %TIME% %RANDOM% %ERRORLEVEL% %CMDEXTVERSION%
%CMDCMDLINE% %HIGHESTNUMANODENUMBER%
"

https://ss64.com/nt/cmd.html

cnd.exe /E:ON Extensions Enabled (Default)

Paul


BINGO! Thanks, Paul. That explains why it was not in the environment output from cmd SET but can be
echoed as if it were an environment variable.

Several years ago i used it in a batch file to mankipulate the string and make it a filename insertable
format. I just dumped the slashes and day prefix since slash is not allowable in a filename. So
"Tues 03/05/2019 became "03052019"

this is the batch file that i wrote which i have found very useful to keep up with file currency and
creartion date of archive files:

~~~~~~~~~~~~~~~~~~

echo %date%

set mth=%Date:~4,2%
set day=%Date:~7,2%
set yr=%Date:~10,4%

echo %mth%%day%%yr%

set shortdate=%mth%%day%%yr%

echo %shortdate%

~~~~~~~~~~~~~~~~~~

of course i could reduce the output but i like to have an idea of progress at certain points and the
final outcome...... :-)


Thanks for the ideas. I like the output formatted with dashes or dots.

echo %mth%-%day%-%yr%
03-06-2019

echo %mth%.%day%.%yr%
03.06.2019


--

Char Jackson
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 01:12 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.