General discussion

Locked

Batch scripts

By steve.doig ·
G'day,

I have a few commands placed in autoexec.bat to append the date and time into a startup log. These will be used to match up shutdown time and dates to see if windows crashes without adding to the log.

The problem are the commands in autoexec.bat:
date >> c:\windows\startup.txt
time >> c:\windows\startup.txt
When autoexec.bat runs, these command require a keyboard command to continue running autoexec.bat (e.g. return). Is there a line of code I can add , such as "Enter", to make sure autoexec.bat doesn't require user intervention to continue running.

The other problem is that windows doesn't shutdown properly, it automatically runs disk doctor in dos. Is there a way to disable this, or set a menu in autoexec.bat to choose between having it off or on, with the default being off?

Thankyou in advance for help.

Cheers.

This conversation is currently closed to new comments.

10 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Batch scripts

by Zalog In reply to Batch scripts

Pipe your commands using the echo command. The command would be 'echo. | date >> c:\windows\startup.txt' and 'echo. | time >> c:\windows\startup.txt'.
Also not there is a '.' after each echo command. This causes and enter to be passed to the dateor time command.

Collapse -

Batch scripts

by Zalog In reply to Batch scripts

The second to last sentence should read: "Also NOTE there is a '.' and a vertical bar after each echo command."

Collapse -

Batch scripts

by steve.doig In reply to Batch scripts

sry pipe command didn't work in dos

Collapse -

Batch scripts

by mphoffar In reply to Batch scripts

I beleive all your need to do is modify the date and time commands with a /T so you commands will look like this

date /T >> c:\windows\startup.txt
time /T >> c:\windows\startup.txt

What that switch does is displays the current date and/or time without prompting for a new one.

Mark

Collapse -

Batch scripts

by steve.doig In reply to Batch scripts

sry - this switch didn't work

Collapse -

Batch scripts

by rucinski In reply to Batch scripts

Start -> Run, and type in MSCONFIG. On the GENERAL tab, click ADVANCED. Check Disable Scandisk.

There is a better method to create a log file of dates and times using just a batch file; it allows you to set evvironment variables for day, date, month and year (Both two and four digit.)

The problem is I have misplaced the technique. I'll post a comment later tonight.

Bob

Collapse -

Batch scripts

by rucinski In reply to Batch scripts

I can't get the "T" switch to work under DOS (Win98 4.10.2222.)

PC Mag and Neil Rubenking in particular have batch file techinques to parse the environment strings.

Hint: Set the attribute on TimeKeep.log to hidden.

Bob

@Echo Off

Ver|Time|Find "Current">$TTemp.bat
Echo Set CTime=%%3>Current.bat
call $TTemp.bat

Ver|Date|Find "Current">$TTemp.bat
Echo Set CDate=%%3 %%4>Current.bat
Call $TTemp.bat

Del Current.bat>nul
Del $TTemp.bat>nul

Echo %CDate% %CTime% >Timekeep.log

Collapse -

Batch scripts

by rucinski In reply to Batch scripts

Correction: The last line of the batch file should be:

Echo %CDate% %CTime% >>Timekeep.log

But you knew that.

Bob

Collapse -

Batch scripts

by steve.doig In reply to Batch scripts

Poster rated this answer

Collapse -

Batch scripts

by steve.doig In reply to Batch scripts

This question was closed by the author

Back to Windows Forum
10 total posts (Page 1 of 1)  

Related Discussions

Related Forums