Results 1 to 5 of 5

Thread: Help needed with DOS commands for BAT file

  1. #1
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Help needed with DOS commands for BAT file

    Here is what I want to do with a BAT file in M2TW, the BAT file is placed in the mod's directory:

    1. Rename the main game's animation folder
    2. Start a mod
    3. Reverse the renaming after mod exit


    Here is what I got so far:
    Code:
    @echo off
    REM going up to main game level
    cd ..\..
    REM changing path to data folder and renaming the main game's animation folder
    cd data
    ren animations animations_backup
    REM back to main game level
    cd .\..
    REM my standard universal batch file entry
    IF EXIST kingdoms.exe (start kingdoms.exe @%0\..\Configuration.cfg) ELSE (
    IF EXIST medieval2.exe (start medieval2.exe @%0\..\Configuration.cfg) ELSE (
        echo ERROR: Cannot find the M2TW or Kingdoms executable.
        echo You probably installed Bare Geomod into the wrong folder.
        pause
      )
    )
    REM pausing the file to wait for input from user after exit
    echo Your input is required to reset a directory name
    pause
    REM reversing the renaming AFTER exiting the game
    cd data
    ren animations_backup animations
    echo Reset is done
    pause
    This works fine but it does require user input which has to be assumed as unreliable. Is there the equivalent of a 'while' or 'wait' command in DOS that I can use instead?
    The start command allows for a /wait switch but I did not manage to make it work because of the required command line, placing it after the exe or at the end crashed M2TW.

    Edit: Using a 'timeout' should work: the generating of new animation files has finished by the time the first movie starts, so setting it to 20 should do the job.
    Last edited by Gigantus; December 02, 2019 at 03:48 AM.










  2. #2
    Leonardo's Avatar Reborn Old Timer
    Join Date
    Mar 2011
    Location
    Southern Sweden
    Posts
    5,245

    Default Re: Helpl needed with DOS commands for BAT file

    Man, I haven't fiddle with DOS commands in ages, so I had to launch the CommandPrompt in Windows just to rehearse what I once knew.

    I think I know what's wrong and that's this.

    Code:
    rem going up to main game level
    cd ..\..
    rem changing to main game's data folder
    cd data
    In order to make the "cd data" command valid you must have a "data" directory present in the root level. Does there exist a "data" directory in the root level?

    Where did you install M2TW, I mean what's the path for your M2TW installation setup?


    You don't need to write the "cd ..\.." command like that when the "cd" command (I can't add a " \ " after "cd", but that's what I mean) does exactly the same thing.
    Last edited by Leonardo; December 02, 2019 at 04:05 AM.
    Under patronage of General Brewster of the Imperial House of Hader.





    How to make Morrowind less buggy for new players - Of course every player may find it useful.

  3. #3
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: Help needed with DOS commands for BAT file

    My test set up is Bare Geomod in a Steam custom installation, using the mod's BAT file:
    D:\Steam\steamapps\common\Medieval II Total War\mods\bare_geomod\universal start.bat

    I would need the full path if I wanted to change directly from the mod's folder to the game's data folder. That simply won't work other then on my machine hence I first went up two levels (from M2TW\mods\BG to M2TW) and then changed to the data sub folder (M2TW\data) present there:
    cd ..\..
    cd data
    After that I went up one level again to M2TW to start executing the normal batch start:
    cd .\..

    Here is the final, working version using a 20 seconds timeout command (the new IDX\DAT files were generated in less then 10 seconds on my machine, but it's pretty fast):
    Code:
    @echo off
    REM --- going up two levels to main game level
    cd ..\..
    REM --- going to the data subfolder and renaming the main game's animation folder
    cd data
    ren animations animations_backup
    REM --- going back up one level to main game level
    cd .\..
    REM --- standard universal batch file
    IF EXIST kingdoms.exe (start kingdoms.exe @%0\..\Configuration.cfg) ELSE (
    IF EXIST medieval2.exe (start medieval2.exe @%0\..\Configuration.cfg) ELSE (
        echo ERROR: Cannot find the M2TW or Kingdoms executable.
        echo You probably installed Bare Geomod into the wrong folder.
        pause
      )
    )
    REM --- pausing the processing of commands for 20 seconds
    timeout 20
    REM --- reversing the renaming AFTER timeout has expired
    REM !! no need to change levels, we are still at the main level
    REM --- going to the data subfolder and renaming the main game's animation folder
    cd data
    ren animations_backup animations
    Last edited by Gigantus; December 02, 2019 at 04:17 AM.










  4. #4
    Leonardo's Avatar Reborn Old Timer
    Join Date
    Mar 2011
    Location
    Southern Sweden
    Posts
    5,245

    Default Re: Help needed with DOS commands for BAT file

    Did the bat file work?
    Under patronage of General Brewster of the Imperial House of Hader.





    How to make Morrowind less buggy for new players - Of course every player may find it useful.

  5. #5
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: Help needed with DOS commands for BAT file

    Here is the final, working version...










Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •