Advertisement
DeathOfTime

RUN.BAT.txt

Aug 24th, 2016
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.23 KB | None | 0 0
  1. @ECHO OFF
  2. SETLOCAL
  3. ::WARNING never run this file unless you are certain of the results. Some of the options in it will create and/or delete massive amounts of files. If not worse things. This is for my use. I will make it public for others to learn from. (if there is anything to learn from this thing)
  4. ::
  5. ::This is a bat file I am putting together to accomplish different tasks I commonly use CMD for. Not all this code originated with me. Though none of it has a copyright or patent associated with it(as far as I am aware)
  6. ::
  7. ::
  8.  
  9. ::Set this bat files CMD window title
  10. title ???
  11.  
  12. ::checks to see if the bat was started as admin. As it doesn't work well under that condition(really need to know how to do this right)
  13. IF "%cd%" == "%HOMEDRIVE%\WINDOWS\system32" goto adminwarn
  14. ::GOTO exit
  15. ::GOTO appdata ::for minecraft launchers. Mainly
  16. ::GOTO server ::for minecraft servers. Mainly.
  17. ::GOTO list  ::creates a timestamped file with a list of the current directories contents in it(useful for modlists)
  18. ::GOTO rename ::buggy. renames files in a directory. currently causes multiple appends.
  19. ::GOTO terraria ::for running a main terraria server, and a temp one side by side.
  20.  
  21. :exit
  22. ::mainly here so pause isn't all over the place.
  23. @ECHO OFF
  24. ECHO End of BAT file Reached
  25. PAUSE
  26. ENDLOCAL
  27. EXIT
  28.  
  29. :adminwarn
  30. ECHO ERROR: RUN.bat was ran as administrator. Early program termination triggerd. Exiting now.
  31. pause
  32. ENDLOCAL
  33. @ECHO off
  34. EXIT
  35.  
  36. :appdata
  37. ::This is setup for launchers to keep as much of there data in the current directory as possible
  38. set APPDATA=%cd%
  39. start javaw -Xmx128M -jar "name.jar"
  40. goto exit
  41.  
  42. :server
  43. @ECHO on
  44. :: To stop a minecraft server type "save-all" then "stop"
  45. java -Xmx4G -jar "name.jar" nogui
  46. goto exit
  47.  
  48. :list
  49. :: Create a file listing the contents of a directory
  50. DIR/B/W *.jar.d >>"%date:~10,4%%date:~7,2%%date:~4,2%-%time:~0,2%%time:~3,2%.txt"
  51. goto exit
  52.  
  53. :rename
  54. :: renames the files in the current directory. Using the parameters given.
  55. :: BUGGY:Currently adds .jar to the end of the file. need to change that. I forget how though.
  56. ren *.jar.d *.jar
  57. GOTO exit
  58.  
  59. :terraria
  60. ::Terraria needs its own section
  61. ::This will launch two servers. One begins the main play server. The other a temp server.
  62. ::Warning: Temp server is deleted every time this file is ran. And a new one created.
  63. ::Warning: This brings my computer to its knees when it is run
  64. start TerrariaServer.exe -config "main.cfg"
  65. IF EXIST ".\Worlds\tmp*" DEL ".\Worlds\temp*"
  66. ::start TerrariaServer.exe -config "temp.cfg"
  67. ::To stop a terria server type in "save", press enter, then "exit", and press enter.
  68. GOTO exit
  69.  
  70.  
  71. EXIT
  72. ::Credits:
  73. ::http://ss64.com/ (The information on the site has helped me vastly in figuring out how to do what I want to do)
  74. ::google (helps with finding example lines for formatting)
  75. ::Thanks to all those out there that every provided a example bit of code.
  76. ::Thanks "SeeMoreGain" on stackexchange (for posting a example filename to another's question on there)
  77. ::Thanks Himeki, they pointed me towards how to code the terraria portion. They know a ton more about terraria then I do (they also said that placing a link to a bat file in "\AppData\Roaming\Microsoft\Windows\SendTo" will add the bat to the list of items in the send to menu.)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement