none
Copy and Paste Batch File Tutorial

    Question

  • I'm actually making .bat or Batch Files for Installing Games like Minecraft for my personal use and public use too.

    Its my first time to make "Batch-stallers" (What i call to Batches that install) which install Minecraft. My plan is to make the Batch file copy from the folder inside the Batch File's Root folder to a place in "%appdata%" because Minecraft is installed there. 

    My Questions:

    1. How to make the batch file copy one from the folder inside the batch file's folder? (The same but changed: What's the example of a command that makes the batch file copy files/folders from where it is put at even if it's put anywhere?)

    2. Is it possible for batch files to reach "%appdata%"? (Because it's hidden)

    3. If the command is complicated, are there more easier way?

    Thanks for people who replied :D

    Thursday, August 08, 2013 7:13 AM

Answers

    1. Check out for /? or call /? on a command line, the secrets of %~dp0 are explained at the end.
    2. bat or cmd scripts are interpreted by cmd.exe, everything you can do on a command line can be also done in a bat or cmd script.  Maybe you'll need "run as administrator" to cause serious havoc in %appdata%.  BTW, that's a sub-directory of c:\users\you (or similar), you can see this with echo %appdata% or set appdata.  Installations for "all users" -- if that's your idea of "public use" -- would use other places.
    3. See Pavel's suggestions.  Don't use a script as wannabe-installer, because the hard part would be the un-installer, with corresponding info stored in the registry.     
    Friday, August 09, 2013 4:50 PM

All replies

  • Better use a *right* tool for the task, from the beginning. NSIS, Inno Setup, yes, this kind.  They come with examples.

    -- pa

    Thursday, August 08, 2013 9:49 AM
    1. Check out for /? or call /? on a command line, the secrets of %~dp0 are explained at the end.
    2. bat or cmd scripts are interpreted by cmd.exe, everything you can do on a command line can be also done in a bat or cmd script.  Maybe you'll need "run as administrator" to cause serious havoc in %appdata%.  BTW, that's a sub-directory of c:\users\you (or similar), you can see this with echo %appdata% or set appdata.  Installations for "all users" -- if that's your idea of "public use" -- would use other places.
    3. See Pavel's suggestions.  Don't use a script as wannabe-installer, because the hard part would be the un-installer, with corresponding info stored in the registry.     
    Friday, August 09, 2013 4:50 PM