1.

Solve : NT4 and %date% and %time% issue?

Answer»

I wrote a simple batch file that keeps track of when specific events happen... that is if it worked correctly. Problem is that the log file is only showing the text with no date or time info.

An instruction as simple as

echo. Run on %date% at %time% >>RunLog.log


The log file is only showing

Run on   at

Tried using echo off instead of the echo. and get the same results. i was thinking at first that it was because NT4 had an issue with echo. vs Echo off, where with echo off used I simply just echo the info and append it to log file.

Not quite sure why this is happening as for I didnt think that NT4 would have a problem with this.

Any ideas of whats going wrong or suggestions on how to fix?

Its been years since I have had to make a batch file for NT4 and I dont recall NT4 having any issues like this one  %date% and %time% weren't available natively in NT4, they came in with Windows 2000, but you can use FOR to parse the outputs of date/t and time/t.

These may work depending on your regional settings (date & time format)

FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO set date=%%B

FOR /F "TOKENS=*" %%A IN ('TIME/T') DO SET time=%%A

See here

http://www.robvanderwoude.com/datetiment.php#SetTime
Thanks Salmon for help with this.

Going to use these methods instead then. Its been almost 15 years since I have had to support a NT4 system, since when 2000 Pro/Server came out that was the hottest OS to run for corporate MS Workstation/Servers and NT4 was changed out rather quickly to 2000 with far more features and far better driver support etc. But this NT4 system remained. 

 SADLY we have a system that has to specifically run NT4 SP6 on and old Pentium III on a machine that was built in 1996, when for what it runs and does I dont see why it couldnt be upgraded to XP ( for newest OS with BEST support for legacy 16-bit programs ), but its a system at work and I am only given the privilege to support it without any unapproved by engineering etc modifications, however I can log activity of systems with scripts etc, and I am trying to pinpoint an oddity with a system and this system in addition to sending instructions to PLC's and other systems, also passes data into a MySQL DB, however the data gathered doesnt specify when specific actions are taken and so I have specific functions that call out for an executable outside of the main executable hitting the batch file before running the executable.  I then can look at the log see when something was run and then hit the database looking at a smaller window of time vs looking at an entire 16 hour run.  Quote from: DaveLembke on April 11, 2015, 09:29:39 AM

I wrote a simple batch file that keeps track of when specific events happen... that is if it worked correctly. Problem is that the log file is only showing the text with no date or time info.

Any ideas of whats going wrong or suggestions on how to fix?


Salmon has the answer, but it's likely to be a 32 bit system I gather so this may work to get reliable date and time info:

Code: [Select]:: date time using an ascii binary
echo off
:: Code by Herbert Kleebauer
echo [email protected]`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>d_t.com
echo 0DxFP,0Xx.t0P,[email protected]$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>>d_t.com
echo LisqMz`[email protected]`[email protected]?ogBgGG}G?j_egoNOG?w?`gBLksqgG`w?WgBgG>>d_t.com
echo G}[email protected][email protected]`LrFuBLyt~vuco{LuKooD?BFHqrIcP>>d_t.com
echo _sdDxb1T??=?rILO_sdDqx1T??=?rILO_sdDnl1T??=?rILO_sdD`c1T??>>d_t.com
echo =?rILO_sdDgg1T??=?rILO_sdDll1T??=?rILO_sdDrr1T??=??IL?0xxx>>d_t.com

d_t.com>d_t.bat
call d_t.bat
del d_t.com
del d_t.bat

echo century: %_cy%
echo    year: %_yr%
echo   month: %_mo%
echo     day: %_da%
echo    hour: %_hh%
echo  minute: %_mm%
echo  second: %_ss%
I wonder what a corporate IT department might have to say about scripts that inject binary code of unknown provenance?

Quote from: Salmon Trout on April 15, 2015, 01:05:14 PM
I wonder what a corporate IT department might have to say about scripts that inject binary code of unknown provenance?

That's always a good question.

I'd also like to know what security updates and precautions are taken on a LAN connected machine that was mothballed when Adam had his first child. Quote
I'd also like to know what security updates and precautions are taken on a LAN connected machine that was mothballed when Adam had his first child.

This system running NT4 is private LAN with no connection to internet. The fact that it is SP6 vs SP0 is probably to support a feature or code that is run on it. This system was implemented here long before I started in 2009. We even have some systems running OpenVMS on old DEC Alpha 64-bit systems. I asked why not replace 20 year old hardware/systems, and I was told that the cost was in the tens of millions for nation wide and the 20 year old DEC Alpha's are surprisingly very reliable running 24/7/365 for last 20 years. They are definitely getting their moneys worth out of this hardware. Quote from: DaveLembke on April 16, 2015, 11:00:36 AM
I asked why not replace 20 year old hardware/systems
Businesses do not replace systems because they are old. They replace systems when they can no LONGER do business with them. I think that is one thing that sometimes isn't fully understood when we see a Text-terminal at an airport or at a grocery store. Especially considering the human cost- now Stacey, who has been working there for 15 years, has to dump her muscle memory and start over with some new-fangled windows program.

Only tangentially related, I suppose. Those OpenVMS systems, THOUGH, are probably running software- replacing them means funding equivalent software for the new system. Was it contracted? who made it? How quickly can a replacement be made? How much will it cost- etc. And the answer will always be that continuing to use the current systems will be cheaper than upgrading them.There are companies that specialize in supporting organisations that are dependent on legacy hardware & software. One I was looking at says their support includes  Alpha, Sun Microsystems and VAX servers. I guess there must be lots of this kind of stuff around.


Discussion

No Comment Found