TechSpot

Launching Batch files from CD

By jjctt
Jan 21, 2008
Topic Status:
Not open for further replies.
  1. Hi.
    A’M new here and I wish to get some help from you expect
    I need someone to help me creating a .Bat file
    I have Battlefield 1, Battlefield 2, Battlefield Special Forces and Battlefield 2142
    I am trying to put all of them on one DVD with a bunch of buttons through Flash.
    I got some updates and NoCD for me not to have to use the Original CD/DVD every time
    I want to play the Game.
    The problem is some of this NoCD’s is more than one file

    (1) Now I need a .Bat file to connect to my Button and burn it on DVD and whenever I put my DVD into the
    DVD-Rom I can click onto this button, it should open the exact Folder where this NoCD is
    Located, in order to copy them and pasta them to where I need them

    (2) Or to have some kind of command file that I can connect to my button
    And when I click on this button, it will copy all this files and go to where I Install the game
    And pasta those even if the Game is not default installed.
    I will very appreciate if somebody can help me with one of my this option
    Thanks
     
  2. kimsland

    kimsland Ex-TechSpotter Posts: 18,353

    I use "Autoplay Menu Builder" for this type of stuff (buttons and flash content)
    This is a licenced product though - which you need to pay for, but it's very good.

    You can also add batch files in there as well

    @echo off
    copy %cdrom%\myCDSubfolder\*.* %programfiles%\NewProgramFolder
    echo.
    echo All Done
    Exit
     
  3. jjctt

    jjctt TS Rookie Topic Starter

    Hi Thanks for the fast reply
    How to do this?
    Can you please tell me how to create this .Bat file?
     
  4. kimsland

    kimsland Ex-TechSpotter Posts: 18,353

    Wow jjctt, you're starting from real basics here. (we all start somewhere I suppose)

    Open Notepad
    Type in all your text commands (there's a CD example above)
    Click on File -> Save As -> All Files (under Save As Type down bottom) -> MyFirstBatFile.bat -> OK

    The enviromental variables ie %programFiles% and %windir% maybe should come later.

    Good Luck :)

    Edit:
    Go to Google type in: how to create a simple batch file
    You'll get 4 Million Tutorials !
     
  5. jjctt

    jjctt TS Rookie Topic Starter

    Hello,
    thanks for the fast answer.
    Yep, just starting.
    What I was really looking for, was a step by step description on what to write
    whithin the notepad.
    I do know how to create a bat.
    What I don't know is: All the orders to be put into it, in order for the wished result.
     
  6. kimsland

    kimsland Ex-TechSpotter Posts: 18,353

    I have an idea, tell me in point form what you want the bat file to do.

    eg

    1. Say Hi, please wait
    2. copy all files from somewhere to somewhere
    3. exit or continue to another step

    Just write something like that I'll post back with a solution
     
  7. jjctt

    jjctt TS Rookie Topic Starter

    Hi, Kimsland
    Thanks for helping me I think you are the only one that wants to help me
    I think is better if I explain it to you what I really need.
    I have Battlefield 1942, 2, Special Forces and 2142.
    I created a folder on my Hard-disk (F) call Battlefield DVD
    Inside This Battlefield DVD folder on (F) I created 3 deferent Folders
    Called Battlefield 1942, Battle Field 2, Battle Field 2 Special Forces Add-On, and Battlefield 2142
    And copy the original CD into each Folder accordingly.

    Under this above Folders I Also created a folder called NoCD for each Game, and I put the NoCD Files in them.
    (For not to have to Use Original CD all the time)
    But some of this NoCD’s have 2 or 3 Files that need to copy and paste them into the Install direction

    Now I am looking for someone who can tell me what to write in this EDITOR and save as .bat file,
    And BURN it with the Games on a DVD, and whenever I install any one of this Games to
    just double click onto this .bat file and it will just
    Copy this 2 or 3 NoCD files from the DVD and paste them into where the game is installed

    But if that is not possible then I will be grateful if you can just tell me what to write
    in this EDITOR and save as .bat file and Burn it with the games. And whenever I click onto this
    .bat file it will open the NoCD Folder on the DVD so that I can just copy them paste them myself
    Thanks a lot JJCTT
     
  8. kimsland

    kimsland Ex-TechSpotter Posts: 18,353

    Here is the bat file: (between the ----, and not including the ----)
    Save it in Notepad as (all files) Battle.bat

    -------------------------------------
    -------------------------------------

    The above file reads like this:

    Name of Bat file is >>Battlefield DVD<<

    Copy ALL files from the CD -> Battlefield DVD\Battlefield 1942\NoCD Folder
    To C:\Program Files\Battlefield 1942 Folder
    Over-Writing any files with the same name

    Copy ALL files from the CD -> Battlefield DVD\Battle Field 2\NoCD Folder
    To C:\Program Files\Battle Field 2 Folder
    Over Writing any files with the same name

    Copy ALL files from the CD -> Battlefield DVD\Battle Field 2 Special Forces Add-On\Battle Field 2\NoCD Folder
    To C:\Program Files\Battle Field 2 Special Forces Add-On Folder
    Over Writing any files with the same name

    Copy ALL files from the CD -> Battlefield DVD\Battlefield 2142\NoCD Folder
    To C:\Program Files\Battlefield 2142 Folder
    Over Writing any files with the same name

    Then exit the batch file

    --------

    Note:

    1.You gave me 4 (not 3) F drive folders
    2.The "copy to" folder, I have assumed as a folder inside Program Files
    3.The "copy to" folder, I have assumed as the same folder name
    4.Using %cdrom% will NOT work unless the files are burnt on the CD
    5.Replace %cdrom% with F: to test if it works before burning
    6.Try to learn what I have done, over and over, until you get it
    7.Make sure all the spaces in the folder names are correct
    8.This line "rem start /D"%cdrom%\Battlefield DVD" ."
    is there to allow you to actually automatically open the CD folder "Battlefield DVD"
    But, you must remove the rem if you do want to automatically open the folder

    One last thing ! Due to the length of the folder names and howmany things are happening, this is Not the best way to learn bat files, and may actually confuse you. Good luck. And reply Back once you understand it a bit better

    Kim
    Also you are better off printing all this
     
  9. jjctt

    jjctt TS Rookie Topic Starter

    Hi, Kim
    Thanks alot I'll try on this weekend and give feed back
     
  10. kimsland

    kimsland Ex-TechSpotter Posts: 18,353

    If you could shorten all the folder names and remove the spaces in them

    ie instead of:
    "Battle Field 2 Special Forces Add-On"
    you could have BF2ADDON

    This would allow you to remove all the quotes
     
  11. jjctt

    jjctt TS Rookie Topic Starter

    Hi Kim.
    Just a shot question, will it also work if I install the game on a different hard disc
    For example F:\Battlefiled 1942????
    thanks
     
     
  12. kimsland

    kimsland Ex-TechSpotter Posts: 18,353

    You can install any program to a different harddisk, but some files, that Windows require, will go on the C drive anyway. So therefore most install programs (and games) to the default C drive.

    Obviously, reading through the steps you will need to change the folder names and locations.
    ie instead of %programfiles% (being c:\Program Files) you will need to specify F\whateverfolder

    If you are creating a disc, it is better to keep everything default, that is use the normal install paths and folders, that way you can use the disc on other computers, or if re-install is required, without remembering where it had to go.
    That is why I have stated %cdrom% instead of a drive name; %cdrom% will work better.

    I am still concerned that learning batch file creation at this level (just above basic!) maybe still too much. ie you may create a lot of coasters (faulty discs) But good luck anyway.
     
  13. jjctt

    jjctt TS Rookie Topic Starter

    Hi Kim
    I tried what you gave me with only Battlefield 1942 but it did not work out,
    but when I write this, it will open the NoCD on the DVD direction for me.
    @echo off
    start /D"%cdrom%\Battlefield DVD\Battlefield 1942\NoCD" .
    echo.
    But if I add the Copy command, it’s brings an error
    copy "%cdrom%\Battlefield DVD\Battlefield 1942\NoCD\*.*" "% programfiles\EA GAMES\Battlefield 1942" >nul
    exit
    Thanks for helping me
     
  14. kimsland

    kimsland Ex-TechSpotter Posts: 18,353

    Dam it I edited it slightly incorrect:

    Should read:
    copy "%cdrom%\Battlefield DVD\Battlefield 1942\NoCD\*.* "%programfiles%\EA GAMES\Battlefield 1942" >nul

    I'll edit my original post too. Thanks

    Edit:

    Sorry the word % programfiles should have been %programfiles%

    Edit Again
    I have now got the original one right. By the way when I edited it, I accidently deleted a line, which I then had to work out what it said, and retype it- how annoying
     
  15. jjctt

    jjctt TS Rookie Topic Starter

    Hi Kim,
    Thank you very much with this here it works perfect
    @echo off
    rem start /D"%cdrom%\Battlefield DVD" .
    echo.
    copy "%cdrom%\Battlefield DVD\Battlefield 1942\NoCD\*.*" "%programfiles%\ea games\Battlefield 1942" >nul
    exit
    But Battlefield 1942\NoCD have this(BF1942.exe, BF1942.org and FOLDER called Mods) this .Bat will copy only
    BF1942.exe, BF1942.org and not the Mods.
    Under this Mods Folder I have 3 Folders called (bf1942, XPack1, and XPack2) and each one them contain
    A file called Mod.DLL now what to write it in the .Bat to also copy this Mods Folder that is currying the 3 folders
    Thanks kim you did me well.
     
  16. kimsland

    kimsland Ex-TechSpotter Posts: 18,353

    Yes the *.* copies all files, but not sub folders

    You will need to add a line saying

    Note: By using the /i (at the end) it will create the directory Mods
    and /q means quiet (do not show any message)

    But I am assuming (as you can see !!) that the mods folder is being copied to C:\program files\ea games\battlefield 1942 and then a new folder (with folders in it) at the end, called mods.

    ie you didn't say where they are being copied to.
    But if I am wrong, for the location of copy to, just change it accordingly.
    ie you are learning now aren't you ?
     
  17. jjctt

    jjctt TS Rookie Topic Starter

    Good teacher thank you
     
  18. kimsland

    kimsland Ex-TechSpotter Posts: 18,353

    That's OK

    You should see my bat files, they're about a mile long !
    One of them took me over a month to do ! ( dots and quotes and spaces can cauuse so much grief)
     
Topic Status:
Not open for further replies.


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.