Help with DOS batch scripting

RagnaroK

Must be dreaming...
Joined
Apr 27, 2002
Messages
673
#1
Hi,
Just wondering if the following is possible:

If I were to put this into a batch file, for example:
Code:
@echo off
echo Copy done @
date /t
time /t
The following would be displayed onscreen correct?
Code:
Copy done @
Mon 01/01/0001
00:01 AM

Now what I want to do is to get the above info displayed onscreen like this instead:
Code:
Copy done @ Mon 01/01/0001 00:01 AM
I want it on the one same line instead of the three lines? Is it possible? Thanks and any input is appreciated. :D
 

the_tazinator

Are we there yet?
Joined
May 19, 2002
Messages
177
#2
This should do what you need to do:

@ECHO OFF
set timestamp=%date% %time%
echo Copy done @ %timestamp%

Sample output:

Copy done @ Sun 01/18/2004 22:33:16.29
 

the_tazinator

Are we there yet?
Joined
May 19, 2002
Messages
177
#4
If you are not doing anything between the time recorded and the time displayed you could just do:

@ECHO OFF
Copy done @ %date% %time%
 

RagnaroK

Must be dreaming...
Joined
Apr 27, 2002
Messages
673
#5
Just what I needed. Thank you very much.
I'm interested in learning more of such programming, do you know where I can do that?

Edit:
Umm, got a problem. Are the %date% and %time% commands OS specific? Because I tested the commands on my WinXP system at home, and they worked fine, but I tried them on a WinNT system, and it doesn't show the date and time. :(
 

the_tazinator

Are we there yet?
Joined
May 19, 2002
Messages
177
#7
I think that those commands will only work on Windows 2000 and above. I haven't used an NT machine in a couple of years so I have dumped most of what I remember about it.
 

Members online

No members online now.

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Hey ep!

All good with me, applying for microsoft mvp right now, should have done this a while ago.

Notifications don't work, I only found your response by comming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier, mine is perriscalderon at gmail
Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...

Forum statistics

Threads
62,030
Messages
673,544
Members
89,038
Latest member
Samhicks