MAMEWorld >> Programming
View all threads Index   Threaded Mode Threaded  

Pages: 1

Naoki
Reged: 11/10/09
Posts: 1998
Loc: United Kingdom
Send PM


Command line scripting
#217747 - 03/24/10 10:34 PM


Yeah, basicly I'm trying to automate a proccess which involves file moving, renaming, update...ect.

I'm having difficulty in that i can't get some syntaxes right and i'm not sure of how to do things. Maybe it would be better in Visual Basic, but my knowledge for that is gone.

What it needs to do is this:
  • Update source code via SVN (Already compiled a script)
  • Compile the resulting C++ into an exe (Already compiled)
  • Change the directory of the root drive.
  • Rename the old exe file using the data in the exe version
  • Change the directory into the "Old" folder
  • Create a new directory based on the filename of the exe
  • Move the old exe file to the newly created folder
  • Move the new compiled exe to the root drive
  • End script

    So far i have:


    Code:

    C:\~~\TortoiseProc.exe /command:update /path:d:\Source\src /closeonend:1 
    makeexe32.bat
    cd D:\
    ren program.exe (code?).exe
    cd D:\Old
    md (code?)
    move D:\****.exe D:\Old\****\ (code syntax wrong?)
    move D:\Source\program.exe D:\ (code syntax wrong?)
    exit



    Any help? Would making a VBasic program be better? If so what code?



  • ----
    On a quest for Digital 573 and Dancing Stage EuroMix 2

    By gods I've found it!



    keshbach1
    Reged: 08/26/05
    Posts: 1303
    Send PM


    Re: Command line scripting new [Re: Naoki]
    #218002 - 03/27/10 12:00 AM


    You would be better served writing the script in a VB.net/C# console application or look up Windows Scripting Host and it's support for vb and jscript.



    Kevin Eshbach



    lharms
    MAME Fan
    Reged: 01/07/06
    Posts: 908
    Send PM


    Re: Command line scripting new [Re: Naoki]
    #218094 - 03/28/10 09:07 AM


    >
    > C:\~~\TortoiseProc.exe /command:update /path\Source\src /closeonend:1
    > makeexe32.bat
    > cd D:\
    REM At this spot you want to run something else
    CodeExtract.exe
    REM this gets the return error code, in C it is the last thing you spit back out just as you exit main.
    REM this puts the error code returned into a command shell variable
    SET CODE = %ERRORLEVEL%
    > ren program.exe %CODE%.exe
    > cd D:\Old
    > md %CODE%
    > move D:\*.exe D:\Old\%CODE%\ (code syntax wrong?)
    > move D:\Source\program.exe D:\ (code syntax wrong?)
    > exit
    >
    >
    > Any help? Would making a VBasic program be better? If so what code?

    vbasic would work but probably overkill? Just depends.

    On a command prompt do 'help set' to see how to mess around with command script vars. At one point I had all sorts of crazy scripts to build and do things. These days I do it in python or C. You eventually get to the point you need functions and batch files just dont cut it. I may have the '%' bits wrong up above. As sometimes you need to do %%ERRORLEVEL%% inside of command files. So you will have to mess around with it a bit. I am doing this off the top of my head (its been a long time) so you will have to mess with it.

    I assume you are trying to create some sort of sub directory that contains the version number. You may also while you are building actually have it just go ahead and create the directory. I have done that in the past too as the program that is doing the compiling usually knows the version number anyway...



    Naoki
    Reged: 11/10/09
    Posts: 1998
    Loc: United Kingdom
    Send PM


    Re: Command line scripting new [Re: lharms]
    #218109 - 03/28/10 02:36 PM


    > >
    > > C:\~~\TortoiseProc.exe /command:update /path\Source\src /closeonend:1
    > > makeexe32.bat
    > > cd D:\
    > REM At this spot you want to run something else
    > CodeExtract.exe

    Is this in mingw's folder?

    > REM this gets the return error code, in C it is the last thing you spit back out just
    > as you exit main.
    > REM this puts the error code returned into a command shell variable

    Whats REM anyway?

    > SET CODE = %ERRORLEVEL%
    > > ren program.exe %CODE%.exe
    > > cd D:\Old
    > > md %CODE%
    > > move D:\*.exe D:\Old\%CODE%\ (code syntax wrong?)
    > > move D:\Source\program.exe D:\ (code syntax wrong?)
    > > exit
    > >
    > >
    > > Any help? Would making a VBasic program be better? If so what code?
    >
    > vbasic would work but probably overkill? Just depends.
    >
    > On a command prompt do 'help set' to see how to mess around with command script vars.
    > At one point I had all sorts of crazy scripts to build and do things. These days I do
    > it in python or C. You eventually get to the point you need functions and batch files
    > just dont cut it. I may have the '%' bits wrong up above. As sometimes you need to do
    > %%ERRORLEVEL%% inside of command files. So you will have to mess around with it a
    > bit. I am doing this off the top of my head (its been a long time) so you will have
    > to mess with it.
    >
    > I assume you are trying to create some sort of sub directory that contains the
    > version number. You may also while you are building actually have it just go ahead
    > and create the directory. I have done that in the past too as the program that is
    > doing the compiling usually knows the version number anyway...

    Yes, would it be different for MAME builds?



    ----
    On a quest for Digital 573 and Dancing Stage EuroMix 2

    By gods I've found it!



    lharms
    MAME Fan
    Reged: 01/07/06
    Posts: 908
    Send PM


    Re: Command line scripting new [Re: Naoki]
    #218121 - 03/28/10 05:32 PM


    > > >
    > > > C:\~~\TortoiseProc.exe /command:update /path\Source\src /closeonend:1
    > > > makeexe32.bat
    > > > cd D:\
    > > REM At this spot you want to run something else
    > > CodeExtract.exe
    >
    > Is this in mingw's folder?
    It probably is not in there you will have to write something

    >
    > > REM this gets the return error code, in C it is the last thing you spit back out
    > just
    > > as you exit main.
    > > REM this puts the error code returned into a command shell variable
    >
    > Whats REM anyway?

    REM is batch script for 'remark'. It lets you put comments into your batch files.

    >
    > > SET CODE = %ERRORLEVEL%
    > > > ren program.exe %CODE%.exe
    > > > cd D:\Old
    > > > md %CODE%
    > > > move D:\*.exe D:\Old\%CODE%\ (code syntax wrong?)
    > > > move D:\Source\program.exe D:\ (code syntax wrong?)
    > > > exit
    > > >
    > > >
    > > > Any help? Would making a VBasic program be better? If so what code?
    > >
    > > vbasic would work but probably overkill? Just depends.
    > >
    > > On a command prompt do 'help set' to see how to mess around with command script
    > vars.
    > > At one point I had all sorts of crazy scripts to build and do things. These days I
    > do
    > > it in python or C. You eventually get to the point you need functions and batch
    > files
    > > just dont cut it. I may have the '%' bits wrong up above. As sometimes you need to
    > do
    > > %%ERRORLEVEL%% inside of command files. So you will have to mess around with it a
    > > bit. I am doing this off the top of my head (its been a long time) so you will have
    > > to mess with it.
    > >
    > > I assume you are trying to create some sort of sub directory that contains the
    > > version number. You may also while you are building actually have it just go ahead
    > > and create the directory. I have done that in the past too as the program that is
    > > doing the compiling usually knows the version number anyway...
    >
    > Yes, would it be different for MAME builds?

    Not sure about MAME I havent dug into how they do their versioning builds in quite awhile. Someone who builds it everyday could say better than I. But my guess is that it is a #define somewhere in the code. If it were me and I was trying to get the version number I would write a small C application that just returns the version number (by including the appropriate header) or creates the directory I want.



    Naoki
    Reged: 11/10/09
    Posts: 1998
    Loc: United Kingdom
    Send PM


    Re: Command line scripting new [Re: lharms]
    #218123 - 03/28/10 06:15 PM


    I'll check later.

    Oh.

    And it uses a seperate C file as i know.



    ----
    On a quest for Digital 573 and Dancing Stage EuroMix 2

    By gods I've found it!


    Pages: 1

    MAMEWorld >> Programming
    View all threads Index   Threaded Mode Threaded  

    Extra information Permissions
    Moderator:  Pi 
    0 registered and 54 anonymous users are browsing this forum.
    You cannot start new topics
    You cannot reply to topics
    HTML is enabled
    UBBCode is enabled
    Thread views: 3731