Author Topic: Batch file help  (Read 10138 times)

jcfuller

  • Member
  • **
  • Posts: 195
Batch file help
« on: January 28, 2013, 11:25:45 PM »

I know Steve and a number of others here do a lot of batch file work so a little help for this aging brain ?

This is the batch file I use to compile bc9
Code: [Select]
@setlocal
@echo off
@REM *******************************************************
@REM Uses bc.exe from c:\bcx\bin for first compile
@REM *******************************************************
@SET PATH=c:\bcxradasm3\bcx\bin;%PATH%
@SET MINGW=C:\Mingwtdm64
@IF EXIST bc9.cpp del bc9.cpp
@IF EXIST bc9.exe del bc9.exe
@ECHO create new 32bit  version of bc9 using MinGWTDM64
@copy source\bc9.bas /Y
@copy source\bc9.rc  /Y

@ECHO Translate bas to cpp using original bc9
bc bc9 -c -ne
@ECHO Compile cpp file
CALL GWGPP bc9 -m32 con -L/pcre-8.32/.libs -lpcrecpp -lpcre -I/pcre-8.32 -DPCRE_STATIC 2> info1.txt


@ECHO Translate bc9 with first generation offspring
bc9 bc9 -c -ne
CALL GWGPP bc9 -m32 con -L/pcre-8.32/.libs -lpcrecpp -lpcre -I/pcre-8.32 -DPCRE_STATIC 2> info2.txt

@ECHO Translate bc9 with second generation offspring
bc9 bc9 -c -ne

CALL GWGPP bc9 -m32 con -L/pcre-8.32/.libs -lpcrecpp -lpcre -I/pcre-8.32 -DPCRE_STATIC 2> info3.txt


IF NOT EXIST out MD out
copy bc9.bas out\bc9.bas
copy bc9.cpp out\bc9.cpp
del out\bc9.exe
copy bc9.exe out\bc9.exe
del c:\bcxradasm3\bcx\bin\bc9.exe
copy bc9.exe c:\bcxradasm3\bcx\bin\bc9.exe
copy Bcx_License.Htm out\Bcx_License.Htm
:done
@ECHO ALL DONE

Every think works fine except the creation date (when viewed with windows explorer) on the copied bc9.exe shows the original
date the file was copied/created to the out and c:\bcxradasm3\bcx\bin\ directories?
The creation date of the file to be copied shows the date and time of the new creation.
I just added the del to see if that would work and it didn't.

How can I have the same creation date and time on the copies as the original.
Thanks

James

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Batch file help
« Reply #1 on: January 29, 2013, 12:04:15 AM »
that is a good one   :P
i have noticed that when assembling files, sometimes

one thing i would do is to rename the files to bc, bc1, bc2, etc
then, delete/rename at the end to straighten things out
when you execute lines like this
Code: [Select]
bc9 bc9 -c -nethere may be some confusion
i am not even sure that line is being executed

as for the date/time stamp
it may well be that the newly created file has an updated timestamp,
but the NTFS buffers don't flush and update - so the old timestamp is still visible

you may have to write an app that sets the creation date and time just to test that theory   :P

jcfuller

  • Member
  • **
  • Posts: 195
Re: Batch file help
« Reply #2 on: January 29, 2013, 01:40:54 AM »
Dave,

Code: [Select]
bc9 bc9 -c -ne
works fine as the first bc9 is an exe looking for bc9.bas

The thing that is bafflig is the original newly created file has the correct time/date stamp but when copied to the other directories it does nt.
James

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Batch file help
« Reply #3 on: January 29, 2013, 01:42:16 AM »
but - doesn't it want to crank out a bc9.exe, at some point ?

jcfuller

  • Member
  • **
  • Posts: 195
Re: Batch file help
« Reply #4 on: January 29, 2013, 01:46:39 AM »
but - doesn't it want to crank out a bc9.exe, at some point ?

Because bc9 is written in itself it needs 3 compiles before any errors manifest themselves.
bc9.exe translates bc9.bas to bc9.cpp
the batch file GWGPP compiles the bc9.cpp to a new bc9.exe

James



Tedd

  • Member
  • ***
  • Posts: 377
  • Procrastinor Extraordinaire
Re: Batch file help
« Reply #5 on: January 29, 2013, 02:58:51 AM »
If you make a copy of a file, then you're creating a new file with the same content - so there will be a new creation time, however the modification time will still be the same as the original.

For build issues that this sometimes causes, there's a tool named 'touch' that will allow you to update or modify the times of files. Or you can make a simple version yourself using the Get/SetFileTime functions.
Potato2

jcfuller

  • Member
  • **
  • Posts: 195
Re: Batch file help
« Reply #6 on: January 29, 2013, 03:14:28 AM »
If you make a copy of a file, then you're creating a new file with the same content - so there will be a new creation time, however the modification time will still be the same as the original.

For build issues that this sometimes causes, there's a tool named 'touch' that will allow you to update or modify the times of files. Or you can make a simple version yourself using the Get/SetFileTime functions.

Sorry Ted that's not what I'm seeing. I'm getting the original creation time when the file was first copied into the out directory ‎(Tuesday, ‎March ‎20, ‎2012, ‏‎12:45:49 PM)  with a new modification time which is the same as the source.

James

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Batch file help
« Reply #7 on: January 29, 2013, 04:57:24 AM »
try rebooting (or maybe log off/log on) and see if it changes

Magnum

  • Member
  • *****
  • Posts: 2378
Re: Batch file help
« Reply #8 on: January 29, 2013, 07:07:55 AM »
Here is a small batch 'Touch' program.

COPY /B c:\masm32\source\bak.bat +,,
Take care,
                   Andy

Ubuntu-mate-18.04-desktop-amd64

http://www.goodnewsnetwork.org

KeepingRealBusy

  • Member
  • ***
  • Posts: 426
Re: Batch file help
« Reply #9 on: January 29, 2013, 08:07:54 AM »
If you make a copy of a file, then you're creating a new file with the same content - so there will be a new creation time, however the modification time will still be the same as the original.

For build issues that this sometimes causes, there's a tool named 'touch' that will allow you to update or modify the times of files. Or you can make a simple version yourself using the Get/SetFileTime functions.

What OS are you running? I think that XP Explorer used to retain the same dates/times when it copied. It seems that Win7 does not.

Dave.

jcfuller

  • Member
  • **
  • Posts: 195
Re: Batch file help
« Reply #10 on: January 29, 2013, 08:23:49 AM »
Still a no go.
OS -> Win7 64
I did not reboot. I have been copying since march of last year and shut down the computer every night so .......
 
James

jcfuller

  • Member
  • **
  • Posts: 195
Re: Batch file help
« Reply #11 on: March 08, 2013, 12:07:27 AM »
Well I think I figured this out and it's a Windows Explorer viewing thingy.
I am primarily interested in the last modification of a file anyway so in Windows Explorer I right clicked the description bar and up pops a list of items to view (yeah I know duh!). I added Date Modified and removed Date Created (which most of the time was the original date when a file with this name was created, not the actual file which had been deleted and recreated.
If I then added Date Created back it would show the correct new creation date.

James

KeepingRealBusy

  • Member
  • ***
  • Posts: 426
Re: Batch file help
« Reply #12 on: March 08, 2013, 09:26:14 AM »

I know Steve and a number of others here do a lot of batch file work so a little help for this aging brain ?

This is the batch file I use to compile bc9
Code: [Select]
@setlocal
@echo off
@REM *******************************************************
@REM Uses bc.exe from c:\bcx\bin for first compile
@REM *******************************************************
@SET PATH=c:\bcxradasm3\bcx\bin;%PATH%
@SET MINGW=C:\Mingwtdm64
@IF EXIST bc9.cpp del bc9.cpp
@IF EXIST bc9.exe del bc9.exe
@ECHO create new 32bit  version of bc9 using MinGWTDM64
@copy source\bc9.bas /Y
@copy source\bc9.rc  /Y

@ECHO Translate bas to cpp using original bc9
bc bc9 -c -ne
@ECHO Compile cpp file
CALL GWGPP bc9 -m32 con -L/pcre-8.32/.libs -lpcrecpp -lpcre -I/pcre-8.32 -DPCRE_STATIC 2> info1.txt


@ECHO Translate bc9 with first generation offspring
bc9 bc9 -c -ne
CALL GWGPP bc9 -m32 con -L/pcre-8.32/.libs -lpcrecpp -lpcre -I/pcre-8.32 -DPCRE_STATIC 2> info2.txt

@ECHO Translate bc9 with second generation offspring
bc9 bc9 -c -ne

CALL GWGPP bc9 -m32 con -L/pcre-8.32/.libs -lpcrecpp -lpcre -I/pcre-8.32 -DPCRE_STATIC 2> info3.txt


IF NOT EXIST out MD out
copy bc9.bas out\bc9.bas
copy bc9.cpp out\bc9.cpp
del out\bc9.exe
copy bc9.exe out\bc9.exe
del c:\bcxradasm3\bcx\bin\bc9.exe
copy bc9.exe c:\bcxradasm3\bcx\bin\bc9.exe
copy Bcx_License.Htm out\Bcx_License.Htm
:done
@ECHO ALL DONE

Every think works fine except the creation date (when viewed with windows explorer) on the copied bc9.exe shows the original
date the file was copied/created to the out and c:\bcxradasm3\bcx\bin\ directories?
The creation date of the file to be copied shows the date and time of the new creation.
I just added the del to see if that would work and it didn't.

How can I have the same creation date and time on the copies as the original.
Thanks

James

What Windows release? I believe that Explorer in XP would retain the original file's creation date and time and use it as the creation date/time for the "COPY", thus both files looked the same. This does not seem to work the same way in Win 7.
Dave

jcfuller

  • Member
  • **
  • Posts: 195
Re: Batch file help
« Reply #13 on: March 08, 2013, 10:04:37 AM »
What Windows release? I believe that Explorer in XP would retain the original file's creation date and time and use it as the creation date/time for the "COPY", thus both files looked the same. This does not seem to work the same way in Win 7.
Dave

See Reply 10.

James