You create and use batch files to automate different system administration tasks, such as backups, program and database updates or recording errors, when an application problems occur. DOS commands that are used in the batch files can include a variable, such as date and time. By using the string of the output from the date and time DOS commands you can create timestamps in the batch files to record time information during execution of system maintenance procedures.
Click "Start," "Notepad" to open Notepad editing program.
Click "File," "New."
Enter the following commands in the open window:
rem Timestamp Generator
rem Parse the date (e.g., Fri 02/08/2008)
rem Parse the time (e.g., 11:17:13.49)
if %cur_hh% lss 10 (set cur_hh=0%time:~1,1%)
rem Set the timestamp format
rem Do something with it
echo Timestamp: %timestamp%
rem Clear the environment variables
Click "File," "Save." Enter "mybatchfile.bat" in the "Save As" box. Click "OK" to create the batch file with timestamps.
- Photo Credit Jupiterimages/Photos.com/Getty Images
How to Remove a Trailing Space in a Batch Variable
Batch files are executable scripts that issue a series of DOS or Windows commands. They are highly useful in system automation tasks...
How to Rename a Series of Files With the Windows Command Prompt
Used normally, the command prompt command *rename* renames a single file, making it little more than an inconvenient alternative to the "F2"...
How to Change the Date Time Stamp on Files
The date time stamp on a file contains information pertaining to the times that the file was created, last modified and accessed....
How to Find a Time Stamp in Your Internet Browsing History
Internet browsers such as Internet Explorer, Mozilla Firefox and Google Chrome keep a list of web sites you visit. This list is...
How to Convert a Datatype Date Timestamp in Oracle SQL
Oracle is the market leader in the relational database management system. DATE and TIMESTAMP are types of the built-in Datetime data types...
How to Add a Date to a Filename in DOS
Using the MS-DOS environment is quite different from operating under a graphic user interface. MS-DOS assumes the user knows specific text commands....
How to Ping With a Time & Date Stamp
Pinging a website's IP address with a time and date stamp is relatively simple. All that is required is access to a...
How to Capture the Date and Time Stamp in DOS Command
Capturing the date and time stamp in DOS when you run a program or perform another task is easily accomplished using batch...