title: Batch script reverse content of text file change load order and reverse again
body: <pre><code>set startpath=%cd%
  del mods.txt
  del mod.txt
  del prioritys.txt
  del desiredmodname.txt
  type NUL &gt; prioritys.txt
  cls
  set /p w3folder=&lt;w3folder.txt
  if not exist "%w3folder%\content\content0" (goto choosew3folder) else goto       askmodkitfolder
  :choosew3folder
  OpenFolderBox.exe C:\ "Appears only on first start or path edit - Please choose your The Witcher 3 Wild Hunt Directory" &gt; w3folder.txt
  set /p w3folder=&lt;w3folder.txt
  :askmodkitfolder
  set /p modkitfolder=&lt;modkitfolder.txt
  if not exist "%modkitfolder%\bin\config\base" (goto choosemodkitfolder) else goto askbasefolder
  :choosemodkitfolder
  OpenFolderBox.exe C:\ "Appears only on first start or path edit - Please choose your Official ModKit Directory" &gt; modkitfolder.txt
  set /p modkitfolder=&lt;modkitfolder.txt
  :askbasefolder
  set /p w3basefolder=&lt;w3basefolder.txt
  if not exist "%w3basefolder%\gameplay\community" (goto choosebasefolder) else goto :selectmods
  :choosebasefolder
  MessageBox.exe "In the next Window you have to select your uncooked base game folder - click on cancel if u dont have it or if u dont know what im talking about :D" "First start/Changed base folder" "OK" "Information" "Button1" "None" "30"
  OpenFolderBox.exe C:\ "choose game base folder-cancel to uncook base game" &gt; w3basefolder.txt
  set /p w3basefolder=&lt;w3basefolder.txt
  Call notEmpty.bat w3basefolder.txt
  If %errorlevel% EQU 0 (goto selectmods) Else (goto uncookbase)
  :uncookbase
  MKDIR "%startpath%\base"
  cd "%w3folder%\xTcTools\bin\x64\"
  call wcc_lite.exe uncook -indir="%w3folder%\content" -outdir="%startpath%\base"
  call wcc_lite.exe uncook -indir="%w3folder%\DLC" -outdir="%startpath%\base"
  set w3basefolder="%startpath%\base"
  :selectmods
  cd "%startpath%"
  del mod.txt
  del modname.txt
  type NUL &gt; mod.txt
  type NUL &gt; modname.txt
  call OpenFolderBox.exe "%w3folder%\mods" "Choose next mod - press cancel to uncook selected mods" &gt;&gt; mod.txt
  Call notEmpty.bat mod.txt
  If %errorlevel% EQU 0 (goto findrepl) Else (goto uncookmods)
  :findrepl
  set /p mod=&lt; mod.txt
  call modname.bat "%mod%"
  cd "%startpath%"
  echo %modname% &gt;&gt; prioritys.txt
  timeout 1
  type "mod.txt"|findrepl /i /o:1:1 &gt;&gt;"mods.txt"
  goto selectmods
  :uncookmods
  set /p uncookmod=&lt; mods.txt
  call modname.bat "%uncookmod%"
  cd "%modkitfolder%\bin\x64\"
  call wcc_lite.exe uncook -indir="%uncookmod%" -outdir="%startpath%\mods\%modname%"
  if not exist "%startpath%\%modname%" (goto quickbms) else goto askmod
  :quickbms
  cd "%startpath%"
  call quickbms.exe -d -o -Y "%startpath%\witcher3.bms" "%uncookmod%\content\blob0.bundle" "%startpath%\%modname%"
  call quickbms.exe -d -o -Y "%startpath%\witcher3.bms" "%uncookmod%\content\blob1.bundle" "%startpath%\%modname%"
  call quickbms.exe -d -o -Y "%startpath%\witcher3.bms" "%uncookmod%\content\blob2.bundle" "%startpath%\%modname%"
  call quickbms.exe -d -o -Y "%startpath%\witcher3.bms" "%uncookmod%\content\buffers0.bundle" "%startpath%\%modname%"
  call quickbms.exe -d -o -Y "%startpath%\witcher3.bms" "%uncookmod%\content\buffers1.bundle" "%startpath%\%modname%"
  call quickbms.exe -d -o -Y "%startpath%\witcher3.bms" "%uncookmod%\content\buffers2.bundle" "%startpath%\%modname%"
  Robocopy.exe /MOVE /S /E "%startpath%\%modname%\blob0.bundle" "%startpath%\mods\%modname%"
  Robocopy.exe /MOVE /S /E "%startpath%\%modname%\blob1.bundle" "%startpath%\mods\%modname%"
  Robocopy.exe /MOVE /S /E "%startpath%\%modname%\blob2.bundle" "%startpath%\mods\%modname%"
  Robocopy.exe /MOVE /S /E "%startpath%\%modname%\buffers0.bundle" "%startpath%\mods\%modname%"
  Robocopy.exe /MOVE /S /E "%startpath%\%modname%\buffers1.bundle" "%startpath%\mods\%modname%"
  Robocopy.exe /MOVE /S /E "%startpath%\%modname%\buffers2.bundle" "%startpath%\mods\%modname%"
  rd /s /q "%startpath%\%modname%"
  :askmod
  MKDIR "%w3folder%\mods\00_MergedMods"
  move "%uncookmod%" "%w3folder%\mods\00_MergedMods"
  cd "%startpath%"
  timeout 1
  type "mods.txt"|findrepl /v /o:1:1 &gt;"mods.txt"
  Call notEmpty.bat mods.txt
  If %errorlevel% EQU 0 (goto uncookmods) Else (goto editfiles)
  :editfiles
  DROPDOWNBOX.exe "Edit Load Order;Edit Files;Build Mod" "What you like to do?" "Option" /RI /C:23 &gt;NUL
  SET ReturnCode=%ErrorLevel%
  IF "%ReturnCode%"=="0" goto editfiles
  IF "%ReturnCode%"=="1" cmd /c "prioritys.txt"
  IF "%ReturnCode%"=="2" %SystemRoot%\explorer.exe "%startpath%\mods"
  IF "%ReturnCode%"=="3" goto robocopy
  goto editfiles
  :robocopy
  set /p modtocopy=&lt; prioritys.txt
  echo %modtocopy% &gt;&gt; IncludedMods.txt
  Robocopy.exe /MOVE /S /E "%startpath%\mods\%modtocopy%" "%startpath%\uncook"
  timeout 1
  type "prioritys.txt"|findrepl /v /o:1:1 &gt;"prioritys.txt"
  Call notEmpty.bat prioritys.txt
  If %errorlevel% EQU 0 (goto robocopy) Else (goto build)
  :build
  rd /s /q "%startpath%\mods"
  InputBox.exe "Enter Name to start building Mod" "Enter Name and Build Mod" "mod" &gt; desiredmodname.txt
  set /p desiredmodname=&lt; desiredmodname.txt
  MKDIR "%startpath%\%desiredmodname%\content"
  MKDIR "%startpath%\cooked"
  cd "%modkitfolder%\bin\x64\"
  call wcc_lite.exe cook -platform=pc -mod="%startpath%\uncook" -basedir="D:\Spiele\Witcher3Mods\Base" -outdir="%startpath%\cooked"
  call wcc_lite.exe buildcache textures -basedir="%startpath%\uncook" -platform=pc -db="%startpath%\cooked\cook.db" -out="%startpath%\%desiredmodname%\content\texture.cache"
  call wcc_lite.exe pack -dir="%startpath%\cooked" -outdir="%startpath%\%desiredmodname%\content"
  call wcc_lite.exe metadatastore -path="%startpath%\%desiredmodname%\content"
  cd "%startpath%"
  rd /s /q "%startpath%\cooked"
  rd /s /q "%startpath%\uncook"
  move "IncludedMods.txt" "%startpath%\%desiredmodname%"
  del mods.txt
  del mod.txt
  del modname.txt
  del prioritys.txt
  del desiredmodname.txt
  move "%startpath%\%desiredmodname%" "%w3folder%\mods"
  MessageBox.exe "All Done enjoy Witcher 3 Wild Hunt now!" "Mod Build Success" "OK" "Information" "Button1" "None" "10"
  exit
  </code></pre>
  
  <p>So this is my code. Everything works fine. Now at the editlines part i give the choice to edit a load order file that looks like this:</p>
  
  <pre><code>modWEATHER  
  modInventoryBackground  
  modTest1
  modTest2
  modTest3
  modTest4
  modTest5
  </code></pre>
  
  <p>is there a way in batch to reverse this file (because i want the prioritys normal like 1,2,3,4,5,6,7 etc but the script later need it in a reversed way because the process itself need it reversed later, because the last loaded files can replace the first  loaded files. (bad english sorry)</p>
  
  <p>so is there a way to reverse this loadorder.txt file give it to the user let him change something and reverse again after?</p>
  
  <p>and in line 84 i pass this loadorder file to the user but it got openened with his standart text editor. Is there a small tool to let the user change load orders of this text file? 
  i hope you understand. </p>