March 25, 200422 yr HiI create my logo and assign a job for each XP install I do. My job number takes the date and time of the day I am working on a piece. eg 200403242038 and this never repeats. Now how can i create a batch file that can automatically assign the date and time so that i can generate this job number
March 25, 200422 yr Author On the cmd when I type Date i get " the current date is *****" " enter new datethe same thing for time. Now I want to capture these parameters ( date and time) so that i can use the generated date and time in my answer file. is it possiblegpm
March 25, 200422 yr This works for Windows NT and up:DATE /T outputs the current dateTIME /T outputs the current time
March 25, 200422 yr Forgot to mention that the output from DATE and TIME can be redirected to another program or to a file.
March 27, 200422 yr Author thanks iam getting somewhere now - is it possible to craete an output file with date and time in one line, why because I want it that way to create a job # for my logo. I use a program called wintrieve to create the logo and put support infogpm
March 27, 200422 yr Dim obj, strASet obj = CreateObject("Scripting.FileSystemObject")Set strA = obj.CreateTextFile("datetime.txt", True)strA.write(now())strA.CloseSet obj = NothingSave that as Datetime.vbs and just run it. It will create the file in same DirYou can change this to whatever you want "datetime.txt" like "C:\App\datetime.txt"
March 27, 200422 yr Windows has 2 variables for this. One is %time% and other is %date%. You can try them by typing echo %time% or echo %date% into the comamnd line. I would use it as: copy backup.rar "%date%backup.rar"
March 27, 200422 yr ,Mar 27 2004, 12:06 PM]Windows has 2 variables for this. One is %time% and other is %date%. You can try them by typing echo %time% or echo %date% into the comamnd line. I would use it as: copy backup.rar "%date%backup.rar"There "/" and ":", this cannot work!You should reformat it:echo %date:/=-% %time::=_%
March 29, 200422 yr Author mdes you are the man thanks a lot - is it possible to take off the spacers28-03-2004 21_*GPM
March 29, 200422 yr set x=%date:/=-%.%time::=_%set x=%x: =0%echo %x:~0,19%=> 29-03-2004.08_01_29See SET/? and FOR/? to see all the possiilities, so you will be able to reverse the date to have yyyy-mm-dd.To have YYMMDD:set x=%date%set yy=%x:~8,2%set mm=%x:~3,2%set dd=%x:~0,2%echo %yy%%mm%%dd% Edited April 9, 200422 yr by mdes
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now