Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am trying to show the time and date on the output file. It won't find it at all, It does however find the %usrid% and %computername%. The other problem i am having is that i am not able to set up a IF statement. I only want it to write to the log file when the registry has that key in it. Any help would be greatly appreciated
Heres the code so far:
echo off
c:\reg.exe query "HKLM\SOFTWARE\Ghost"
echo %date% %time% %usrid% %computername% %ddate% >> c:\test.log
exit

DOS doesn't allow you to set DATE and TIME evars directly. It can be done with some nesting of bat files. Also there may be some com files on the Web which will return the values separatly. Look for: time.com and date.com. I'm not familiar with "querying" the registry. I can e-mail you some bat files that may help.

Anything at all would help. I am creating this file to track some license features and it works well, except for the time date.
thanks

well, I was able to do it straight from dos... but it'll read the system time, not from the registry... will that help?
(used it in my self-installing batch file that tracked when my computer was being turned on without my permission... room-mates BAH!)

Rob,
That might be just what i am looking for!
(besides i think i need that at home too. roomates... only good for the rent check!)

erm as a thought, the prompt command allows you to display the date and time. All you need then is to find some way to pipe the prompt to a file or something...

To get the time and date in a file you can try following batchfile:
@echo off
echo.>%temp%~test.tmp
date<%temp%~test.tmp>>datetime.log
time<%temp%~test.tmp>>datetime.log
del %temp%~test.tmp
type datetime.log
exit

To put date and time in a log file I use:
echo | more | time | find "Current"
echo | more | date | find "Current"

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |