0

DOS for Windows, 32 bit

I have a program that saves data to a folder as an .rpt file. The file name is the input serial number of the part being checked with a preceding "C".

Subsequent runs of the same serial number over writes the original .rpt file.

I'd like to add a suffix to the serial number that's unique every time the program runs.

I was thinking I could use the time stamp. I'd like to convert the time stamp at the end of the run to a numeric value, set that value as a variable, and add it to the serial number with a preceding underscore.

Like this . . . (Note, we prefix ser nos with a "C")

(INPUT serial number) SN

Var1 = "_" + current time expressed as a numeric value

Var2 = "C" + SN + var1 + .rpt

So C12345.rpt would become C12345_102233.rpt (some numeric value)

Thanks for any help or ideas.

This is the old code . . .

PA,1,MOVE.PRG,NEW
OP,'^Z'
! OP,'PRI C',(SN),'.RPT >NUL'
OP,(T),'COPY C',(SN),'.RPT C:\PARSE >NUL',(T)
OP,(T),'COPY C',(SN),'.RPT Q:\CMM_DATA\',(F),'\PWAFILES\',(WAXDIE),' >NUL',(T)
OP,(T),'COPY C',(SN),'.RPT Q:\CMM_DATA\',(F),'\GPFILES >NUL',(T)
OP,'DEL C',(SN),'.RPT >NUL'
OP,'^Z'
OP,'ET,CL'
EP,1
TI,MOVE.PRG
Ben
  • 51,770
  • 36
  • 127
  • 149
  • This question has been asked numerous times: http://stackoverflow.com/questions/11037831/filename-timestamp-in-batch-script and http://stackoverflow.com/questions/1642677/generate-unique-file-name-with-timestamp-in-batch-script are two such examples. – James L. Mar 07 '14 at 21:28
  • Welcome to StackOverflow. You're going to have a better chance of getting an answer if you properly tag your question with the language you're using. Your code in the "This is the old code" section is unfamiliar to me and your tags don't help. – Mark Mar 07 '14 at 21:47
  • I tried adding some tags when I wrote the post. But the only tags I could think of were "DOS For Windows" & "time stamp". I did read the posts you referenced, BEFORE I posted my question. The code in the answers didn't look like any code in the batch files (programs) I had, so I thought they were not in DOS. The "program" I'm using is "CMES For Windows, 32 bit". DOS based, OLD software. – user3393650 Mar 07 '14 at 22:02

0 Answers0