Computing.Net > Forums > Disk Operating System > Dos Batch File Programming

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Dos Batch File Programming

Reply to Message Icon

Name: Pat
Date: March 15, 2000 at 10:02:40 Pacific
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Michael Robertson
Date: March 15, 2000 at 11:33:33 Pacific
Reply:

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.


0

Response Number 2
Name: Pat
Date: March 15, 2000 at 12:15:59 Pacific
Reply:

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


0

Response Number 3
Name: Carlos Acuna Gonzalez
Date: March 15, 2000 at 21:49:16 Pacific
Reply:

on the old norton utilities ther wher a program that could write the date and time.


0

Response Number 4
Name: rob Bruce
Date: March 15, 2000 at 23:44:11 Pacific
Reply:

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!)


0

Response Number 5
Name: Pat
Date: March 16, 2000 at 07:14:09 Pacific
Reply:

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!)


0

Related Posts

See More



Response Number 6
Name: Mr obscurity
Date: March 18, 2000 at 12:51:28 Pacific
Reply:

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...


0

Response Number 7
Name: Kasper
Date: March 22, 2000 at 10:49:47 Pacific
Reply:

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


0

Response Number 8
Name: Allen
Date: March 23, 2000 at 10:38:49 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Dos Batch File Programming

DOS batch file programming www.computing.net/answers/dos/dos-batch-file-programming/8142.html

HELP ME WITH DOS BATCH FILES LINES PLEASE www.computing.net/answers/dos/help-me-with-dos-batch-files-lines-please/2496.html

Dos Batch file www.computing.net/answers/dos/dos-batch-file/5691.html