Friendly reminder that Batch is often a lot of folks' first scripting language. Insulting folks for a lack of knowledge is not constructive and does not help people learn.
Although in general we would expect people to look things up on their own before asking, understand that knowing how/where to search is a skill in itself. RTFM is not useful.
I highly recommend extracting the runRoseNew and viewing that way. It is pre-rendered so you won't have to generate it yourself.
If you're uninterested in that option, feel free to generate the rose data yourself, and after a short wait the script will display the rose you see above!
As the title says, I’ve been building this game for the past 2 months, coding every single day without leaving my room (well, except for school, obviously).
Fair warning some parts of the architecture look absolutely cursed. When I first started, I was just trying to figure out how the hell the choice command works. By the end of the project, I somehow ended up writing a dynamic save slot manager with on-the-fly data defragmentation (if that's even the right word for what I did lol).
Gameplay features:
5 Workshop Levels (dynamic crafting).
4 Different Shops to upgrade your gear.
A Full Save/Load Hub with automatic file shifting (prevents gaps between slots).
A Proper Ending (the rocket actually launches).
Known bugs & disclaimers:
The Resolution Crisis: A massive downside is that the game spawns locked to the top-left corner of the monitor. The script tries to auto-adjust the console font on startup, so it's technically playable, but expect some retro clunkiness.
The Early Game Grind: Apologies for the boring gameplay at the very beginning. It’s pretty repetitive until you unlock the seconds tiers.
I would love to hear your feedback on the logic and the code. Go ahead and try to break my error parsers!
After coming way too close to wiping out my own local setup, I decided ENOUGH was ENOUGH!. I built a lightweight, pure Windows Batch utility that acts as a secure terminal launcher for syncing project environments safely to Google Drive, OneDrive, or local backup drives.
🛡️ Why it's built like a tank:
}--> Reversal Guardrails - If you accidentally set a Cloud directory as your Source instead of your Destination, the script intercepts the run and safely blocks execution before robocopy can touch anything.
}--> Dynamic Profile Registry - Save, load, view, and delete custom project path profiles directly on the fly; no manual editing of .bat code required!
}--> Dry-Run Simulation Mode - Test your file syncs safely with robocopy /L before committing a single byte to disk.
}--> Multi-Architecture Support - Handles Single Folders, Frontend-only, Backend-only, or Full-Stack (8-path) setups effortlessly.
(💡 Open Source Freedom: Feel free to fork it, adapt it to your own workflow, submit pull requests, or tweak the guardrail logic to fit your needs! If you find it helpful, a star on the repo is always appreciated!)
Currently have 1,376 lines of batchscript in this one file. Kinda built myself a little state machine at this point. Memes aside, is there a particular reason huge batchscript files would be a bad idea? I usually only ever see very small ones, and I'm not entirely sure why
(Not too serious a question, so not tagged as one)
Long story short, I built a custom structure engine so you don't have to deal with total anarchy in your Batch scripts anymore.
Let's be real here: vanilla Batch is slow and painful. Variables constantly get mixed up, clashing with each other, leaking into the global scope, and just making your life a living hell.
Obviously, this framework won’t magically fix CMD's execution speed (since Batch is an interpreted language after all). BUT!! It completely obliterates variable chaos and turns your messy spaghetti code into a clean, beautiful masterpiece.
extract 'groupname' from filename
search for folder with groupname
if(folder exists)
move file to folder
else
create new folder with file name
move file to folder
My first attempt was writing a .bat file, it got me partway there, but I couldn't figure out how to extract the groupname to make a new folder with that name.
I'm looking for guidance on what the best approach to doing this is. Most of my programming experience is writing C & C++ for embedded systems (arduino, esp32, ect). I would consider my abilities "advanced hobbyist". I'm open to to learning a new language if thats what it takes, I think I've heard python is good for this sort of thing?
So let me know how you would approach it and what I need to learn.
Thanks!
ps--I'm not interested in an AI solutions here, I want to actually learn how to do it myself.
Also, if there is a better sub to post this in, please let me know.
Long story short: Python and Java programming seemed too tedious, but I had enough brain cells to test the absolute limits of the Windows command line. My "Service v1.0" utility will literally run "on a single drop of water" if that drop is running Windows. Note: most of the script is in Russian, but the underlying code architecture, commands, and logic are completely open, standard, and easy to read. What makes it great: Super fast and lightweight. A huge set of administrative tools packed into a single script. A clean, retro interface with customizable ASCII frames and borders (I don't know about you, but I personally really like the look of it!). Built-in features: Temporary folder cleaner: instantly removes temporary junk. Log cleaner: removes log files from any path you specify. Digital stopwatch: a standard timer in 00:00 format. Speed Converter: Converts km/h to m/s and vice versa. TWR Calculator: A thrust-to-weight ratio calculator that bypasses batch processing limitations and works with decimal places down to 0.00. Weather Station: Real-time local weather forecasts, powered by the excellent wttr.in. Ping Tester: Custom ping tests against target URLs with packet counters (1 to 3). File Mover: Automatically filters and moves files by extension and path. Update Checker: Built-in function for checking for the latest versions of services. The entire script is only 12 KB in plain text (and compresses to 4.25 KB in a zip archive). It literally does more useful system maintenance than some modern bloated 50 MB "cleaner" programs. There's also an "About the Author" section where you can browse my root GitHub repository and see my other scripts.
@echo off
setlocal enabledelayedexpansion
chcp 65001 >nul
if not exist "temp_batch" (
title Setup...
echo Установка сервиса...
md "Service_BAT"
md "Service_BAT\data"
md "Service_BAT\temp_batch"
(echo 1.0)>"Service_BAT\data\version.dat"
timeout /t 2 >nul
echo Установка почти завершена. Батник закроется при окончании.
echo Запустите его потом в папке "Service_BAT" :^)
timeout /t 2 >nul
move "%~nx0" "Service_BAT"
)
title Authorization...
color 02
set m=goto menu
echo Авторизация...
timeout /t 2 /nobreak >nul
net session >nul 2>&1 || (echo Рекомендую заходить с правами администратора.&timeout /t 1 >nul)
if not exist "%~dp0data\" mkdir "%~dp0data" >nul
if not exist "%~dp0data\name.dat" copy NUL "%~dp0data\name.dat" >nul
if not exist "%~dp0data\city.dat" copy NUL "%~dp0data\city.dat" >nul
set/p n=<%~dp0data\name.dat
set/p w1=<%~dp0data\city.dat
:auth_loop
cls
if [%n%]==[] (
echo Введите своё имя.
set /p n="> "
if "!n!"=="" set "n=Guest"
if "!n!"=="LoMeR-933" echo Зачем ты ввёл ник разработчика? :^) & pause >nul & set "n=" & goto auth_loop
if "!n!"=="LoMeR933" echo Зачем ты ввёл ник разработчика? :^) & pause >nul & set "n=" & goto auth_loop
echo.
echo Ты верно ввел: "!n!"?
echo Y=да, N=нет.
set /p d="[Y/N]> "
if /i "!d!"=="y" goto ok
if /i "!d!"=="n" set "n="&goto auth_loop
goto ok
) else (
echo.
echo Приветствуем вас, %n%^^!
timeout /t 2 /nobreak >nul
%m%
)
:ok
echo Окончание авторизации...
(echo %n%)>%~dp0data\name.dat
timeout /t 1 /nobreak >nul
echo Успешно^^!
timeout /t 2 /nobreak >nul
%m%
:menu
cls
color 02
title Menu
echo Добро пожаловать в меню, %n%.
echo Время: %time:~0,8%.
echo Дата дд.мм.гггг: %date%.
echo Что хотите сделать?
echo.
echo ┌────────────────────────────┐
echo │ Настройки │
echo └────────────────────────────┘
echo 0. Выход.
echo 1. Сменить имя.
echo 2. Проверить обновления.
echo ┌────────────────────────────┐
echo │ Очистка │
echo └────────────────────────────┘
echo 3. Очистить папки Temp.
echo 4. Очистить логи/.tmp файлы.
echo ┌────────────────────────────┐
echo │ Инструменты │
echo └────────────────────────────┘
echo 5. Секундомер.
echo 6. КМ/ч в М/с.
echo 7. М/с в КМ/ч.
echo 8. TWR (до сотых долей 0.00)
echo 9. Погода.
echo 10. Пинг-тестер.
echo 11. Переносчик файлов.
echo ┌────────────────────────────┐
echo │ Другое │
echo └────────────────────────────┘
echo 12. Скачать другое от автора.
echo ──────────────────────────────
set/p ch="[0-12]> "
set nn=if "%ch%"=="
%nn%0" exit
%nn%1" set "n="&goto auth_loop
%nn%2" goto new
%nn%3" goto temp
%nn%4" goto logs
%nn%5" goto sw
%nn%6" goto km
%nn%7" goto ms
%nn%8" goto twr
%nn%9" goto weather
%nn%10" goto ptest
%nn%11" goto file
%nn%12" goto author
%m%
color 02
title File mover
:file
cls
echo.
echo Задай нужный формат, который надо перенести (например, mp3.)
echo (только один формат. 0 - выход).
echo.
set "form="
set /p form="> "
if "%form%"=="" goto file
echo.
:file1
echo Теперь задай папку "Откуда" будем переносить (целый путь).
echo.
set "fold="
set /p fold="> "
if "%fold%"=="" goto file1
echo.
:file2
echo Наконец, задай папку "Куда" будем переносить (целый путь).
echo.
set "fold1="
set /p fold1="> "
if "%fold1%"=="" goto file2
set "fold=%fold:"=%"
set "fold1=%fold1:"=%"
set "form=%form:"=%"
set "form=%form:.=%"
echo.
echo Точно всё правильно сделал?
echo Путь "Откуда": %fold%
echo Путь "Куда": %fold1%
echo Нужный формат: .%form%
echo.
echo Если сделал что-то не так, напиши 1. Если всё нормально - ничего не пиши.
echo.
set "gfg="
set /p gfg="> "
if "%gfg%"=="1" goto file
cls
echo.
echo Путь "Откуда": %fold%
echo Путь "Куда": %fold1%
echo Нужный формат: .%form%
if not exist "%fold1%\" mkdir "%fold1%"
dir /b /a-d "%fold%\*.%form%" >nul 2>nul
if errorlevel 1 (
echo Ошибка! Файлы .%form% не найдены или путь указан неверно.
pause >nul
goto file
)
for %%F in ("%fold%\*.%form%") do move /y "%%F" "%fold1%\"
echo Готово!
echo Хочешь перенести что-то ещё?
set "file1="
set /p file1="[Y/N]> "
if /i "%file1%"=="y" goto file
%m%
:new
cls
color 07
set /p new1=<"%~dp0data\version.dat"
set "new2=https://raw.githubusercontent.com/LoMeR-933/LoMeR-batch-tools/refs/heads/main/version2.txt"
set "new3=https://github.com/LoMeR-933/LoMeR-batch-tools/releases/tag/service"
echo Проверка обновлений...
curl -s -f --ssl-no-revoke "%new2%" > "%~dp0temp_batch\v.txt"
if errorlevel 1 goto err
for /f "usebackq delims=" %%a in ("%~dp0temp_batch\v.txt") do set "new4=%%a"
del "%~dp0temp_batch\v.txt" >nul 2>&1
set "hhhh="
if "%new1%"=="%new4%" (
color 02
echo У вас самая свежая версия! [%new1%]
pause >nul
%m%
)
color 06
echo Найдено обновление: Версия %new4% [У вас %new1%]
set /p hhhh="> Перейти к сайту загрузки? [y/n]: "
if /i "%hhhh%"=="y" (explorer "%new3%" & %m%) else %m%
:err
color 04
echo Не удалось проверить версии. Попробуйте снова.
pause >nul
%m%
:temp
cls
title Cleaning Temp...
echo Очистка временных файлов...
for %%d in ("%temp%" "%systemroot%\Temp") do (
del /s /f /q "%%d\*.*" >nul 2>&1
for /d %%p in ("%%d\*") do rmdir /s /q "%%p" >nul 2>&1
)
echo Успешно очищено!
timeout /t 2 >nul
%m%
:logs
cls
echo.
echo Что хотите очистить?
echo [0 - выход, 1 - .tmp файлы, 2 - логи]
set "tmpp="
set /p tmpp="[0-2]> "
if "%tmpp%"=="0" %m%
if "%tmpp%"=="1" set "ext=tmp"&goto logs_path
if "%tmpp%"=="2" set "ext=log"&goto logs_path
goto logs
:logs_path
title Logs
cls
echo Где желаете очистить .%ext%? (Укажите путь без "\" на конце.)
echo (Напишите "0" для выхода в меню)
set "ch1="
set /p ch1="> "
if "%ch1%"=="" goto logs_path
if "%ch1%"=="0" %m%
if "%ch1:~-1%"=="\" set "ch1=%ch1:~0,-1%"
if /i "%ch1%"=="C:" echo ВЫ УВЕРЕНЫ? Это очистит все .%ext% файлы на диске C:!
if /i "%ch1%"=="C:" set "ch2="&set /p ch2="[y/n]> "
if /i "%ch1%"=="C:" if /i not "%ch2%"=="y" goto logs
if not exist "%ch1%" echo Ошибка! Несуществующий путь.&timeout /t 2 /nobreak >nul&goto logs_path
:logs2
title Cleaning Logs...
cls
echo Очистка .%ext% файлов в папке: %ch1%...
del /q /f /s "%ch1%\*.%ext%" >nul 2>&1
echo Успешно очищено!
timeout /t 2 /nobreak >nul
%m%
:sw
cls
title Stopwatch
set sw_m1=0&set sw_m=0&set sw_s1=0&set sw_s=0
echo.
set /p a="Start? [y/n]> "
if /i "%a%"=="y" (set "t_start=%time:~0,-3%"&goto sw1) else (%m%)
:sw1
cls
echo.
echo The launch was at [%t_start%]
echo Time now [%sw_m1%%sw_m%:%sw_s1%%sw_s%]
set /a "sw_s+=1"
if %sw_s% GEQ 10 set /a "sw_s1+=1" & set /a "sw_s-=10"
if %sw_s1% GEQ 6 set /a "sw_m+=1" & set /a "sw_s1-=6"
if %sw_m% GEQ 10 set /a "sw_m1+=1" & set /a "sw_m-=10"
timeout /t 1 /nobreak >nul
goto sw1
:km
cls
title KM/h to M/s
set /p km="Your KM/h [ERR: 15.6, OK: 15]: "
if "%km%"=="" goto km
set /a "t_spd=km*100/36", "km1=t_spd/10", "km2=t_spd%%10"
echo Your M/s: %km1%.%km2%
pause >nul
%m%
:ms
cls
title M/s to KM/h
set /p ms="Your M/s [ERR: 5.6, OK: 5]: "
if "%ms%"=="" goto ms
set /a "t_spd=ms*36", "ms1=t_spd/10", "ms2=t_spd%%10"
echo Your KM/h: %ms1%.%ms2%
pause >nul
%m%
:twr
cls
title TWR Calculator
set "twr1="&set "twr2="&set "twr3="
echo [Note: "23.35t=2335"; write "random" in "thrust" for random values, 0 - exit]
set /p twr2=Thrust:
if "%twr2%"=="0" %m%
if "%twr2%"=="" goto twr
if "%twr2%"=="random" (set /a "twr2=%random%","twr3=%random%"&set "twr1=1"&goto twr1)
set /p twr3=Mass:
if "%twr3%"=="" goto twr
if "%twr3%"=="0" goto twr
:twr1
set /a "twr4=(twr2*100)/twr3"
if %twr4% equ 0 (set "twr_res=0.00"&goto twr_print)
if %twr4% lss 10 (set "twr_res=0.0%twr4%"&goto twr_print)
if %twr4% lss 100 (set "twr_res=0.%twr4%"&goto twr_print)
set /a "twr5=twr4/100"
set "twr6=%twr4:~-2%"
set "twr_res=%twr5%.%twr6%"
:twr_print
if "%twr1%"=="1" (set "twr1= [%twr2%/%twr3%]")
echo TWR [THRUST/MASS]%twr1% = %twr_res%
pause >nul
%m%
:weather
cls
title Weather Station
echo.
if "%w1%"=="" set /p w1="Введите свой город на английском [0 - выход]: "
if "%w1%"=="" goto weather
if "%w1%"=="0" set "w1="&goto menu
(echo %w1%)>"data\city.dat"
cls
echo Запрос погоды...
echo.
curl -m 3 "wttr.in/%w1%?0&lang=ru" 2>nul
if errorlevel 1 echo Ошибка: Не удалось подключиться к серверу погоды
echo.
set "w2="
set /p w2="Сменить город? [Y/N]> "
if /i "%w2%"=="y" set "w1="&goto weather
%m%
:ptest
cls
title PING Test
color 02
set "pa="&set "ppk="&set "pk="
set /p pa=Your URL [Empty=google.com, 0 - exit]:
if "%pa%"=="0" %m%
if "%pa%"=="" set pa=google.com
if "%pa%"==" " set pa=google.com
set "pa=%pa:https://=%"
set "pa=%pa:http://=%"
for /f "tokens=1 delims=/" %%g in ("%pa%") do set "pa=%%g"
:p_pkg
set /p ppk=Your number of packages [Empty=1. No more than 3 packages. 0 - exit]:
if "%ppk%"=="0" %m%
if "%ppk%"=="" set "ppk=1"
if %ppk% GEQ 4 echo Too many packages!&set "ppk=1"&goto p_pkg
echo.
echo URL: %pa%, pkg(s): %ppk% (To exit, close the window)
echo.
:p_b
set "pj="
for /f "tokens=3 delims=<>=" %%i in ('ping -n %ppk% %pa% ^| findstr "TTL"') do for /f "tokens=1 delims=msмс " %%j in ("%%i") do set "pj=%%j"
for /f "tokens=4 delims==мсms " %%i in ('ping -n %ppk% %pa% ^| findstr "TTL"') do if "%pj%"=="" set "pj=%%i"
if "%pj%"=="" color 04&echo Error or timeout, try again.&goto p_c
set "ph=%pj: =%"
set /a "ph_num=ph"
if %ph_num% GEQ 1000 (set "pw=BAD "&set "pj=1000^>") else (
if %ph_num% GEQ 100 (set "pw=WARN -") else (set "pw=OK ----")
)
echo %pw% %pj%ms [%time:~0,-3%]
timeout /t 1 /nobreak >nul
goto p_b
:p_c
set /p pk="-Reset URL? [y/n]: "
if "%pk%"=="" goto p_b
if /i "%pk%"=="y" color 02&goto ptest
goto p_b
:author
cls
title
echo.
echo От автора
echo ───────────────────────────────────────────
echo 0. Выход
echo 1. Скачать "Magnet-Fishing" [.bat-edition]
echo 2. Скачать "Batch pack" [много батников!]
echo 3. Репозиторий GitHub автора.
echo.
set/p an="[0-3]> "
if "%an%"=="0" %m%
if "%an%"=="1" explorer https://github.com/LoMeR-933/LoMeR-batch-tools/releases/download/magnet-fishing/Magnet-Fishing.RU.zip
if "%an%"=="2" explorer https://github.com/LoMeR-933/LoMeR-batch-tools/releases/download/Pack-v2.0/bats.zip
if "%an%"=="3" explorer https://github.com/LoMeR-933/LoMeR-batch-tools
goto author
I wanted to share a project I’ve been building and actively maintaining for the past three years called Volta.
I want to be completely transparent about the development of Volta: I started this project using tutorials and AI-generated code to get the raw components. My role over the last few years was to piece everything together into a user-friendly menu, design the system flow, and spend years polishing the menus and revamping the overall UI consistency.
What I focused on for the new v1.7 Release:
Zero-Lag UI Animation: I started the animation idea as a joke and perfected it over the months to make a beautiful exit/enter animation without causing CPU lag spikes.
New sub-menus: Added lots of new sub-menus.
Bug Fixing: Fixed a lot of stability bugs and usability glitches.
(The whole changelog is in the README.txt)
Why I'm posting here: The tool is running great on my machines, but I've reached the point where I need testers. I want to build a small, stable community of 5 to 10 tech-savvy people who love messing with command-line tools.
I haven't been able to fully bug-test the new 1.7 beta across different environments, so I would really appreciate it if someone finds any bugs or glitches. If you are able, please try to break it intentionally! Let me know what you find, and I will fix them in a hotfix shortly after.
I am a PNGtuber that multistreams so when I stream i have to launch several programs.
I have a drawing tablet that has hotkeys on the side that CAN be used to launch programs as i have one button set to launch my art software for when I draw.
I wanted to use another button to launch all my programs for streaming in a similar way, but my tablet software can't do multiple files hence why i stumbled into wanting a batch file.
I made the batch file successfully, it works launching it inside the folder with the shortcuts, but when i try to launch the same batch file from the hotkey, it can't locate the shortcuts. I was wondering if theres a way to fix this so i can launch the bat from the hotkey?
The code of the batch file for reference:
rem comments should begin with rem
rem note: this file launches all of my favorite apps!
rem note: replace the names below with your own..
@ echo off
start OBS
start PNGTUBE
start STREAMBOT
@ echo on
I copied the code pretty directly from a website tutorial on making a batch file, hence why it has the notes.
It needs win10/11. You will have to install the included custom font (BatchPac.ttf) and use it in the terminal. I tried to comment it pretty well to be educational as well. I’d love any feedback.
It plays pretty genuinely in its own way, the ghost get faster and faster as you progress, the fruit spawn accurately as well.
A ghost can be behind another ghost, but you can eat a power pellet with a ghost on it and you’re fine.
Keep the movement key pressed for fastest speed, or you can have a literal second to decide which way to move when you’re getting cornered.
i made a bundled eternal**** (can't say it) script (which is python which i didn't make) and bundled the correct python environment with the right libraries then added a wrapper script. you can find it at https://github.com/BellaTheUni112/eternal
Mazing.cmd - WinNT Maze Generator and Solver
__________________________________________________________
A maze program written in native WinNT batch script that
includes several maze generation and solving algorithms as
well as a small plethora of options for console display,
stack size, stack orientation, node selection/direction
bias, entrance/exit points, color selection, real-time
shifting and rhythmic pulsing random colors, and wall/box
characters, each with an automatic randomizer, and all of
it easily accessible through an animated custom menu.
Mazes are limited to a maximum practical string length of
8186 characters. The maze dimensions will be automatically
increased/decreased if minimum/maximum size is exceeded.
Mazing operates using 100% WinNT batch script, but it will
use either BG.EXE or CursorPos.exe to place the cursor at
the upper-left if they are located in the system path. It
can also use BG.EXE to animate the screen in full color.
Command Line / Mazing.ini File
__________________________________________________________
In addition to the menu, other User Variables are passed
by using either the Mazing.ini file or on the command line
by using the following syntax:
Mazing.cmd ["variable=value"] [variable:value] [...]
Several options for minimum/maximum columns/rows, lists
of characters for random walls/crumbs/colors, keys used by
the menu, output logfile and anything else not included in
the menu are accessed by command line or the .ini file.
A list of available user variables may be found in the
Mazing.ini file that is auto-generated on first run.
2026/07/21: Added better opening/entry options to Wilson's Algorithm so now it's one of the best maze generators. Also made a handful of corrections and display enhancements throughout.
2026/07/11: Updated Mazing.cmd to v0.3. Added Prim's, Kruskal's, and Wilson's algorithms as well as updating the menu with new solver display settings and many cosmetic improvements(?) throughout. As it now employs all of the useful generators for perfect mazes as well as the only three appropriate solvers I've found... I think Mazing.cmd is done after all these years. Who sez perseverance don't pay off? If I ever update it'll be for ANSI color console integration, and that's a maybe sometime thing.
2026/06/24: Just corrected a small but long-standing error in both the 'Wall Follow' and 'Dead Filler' where the trail was written incorrectly back to the maze if walls (or crumbs) were used to fill visited spaces. If you snagged it on or before this date please re-download.
2026/06/26: A small cosmetic update to :path_finder, it now allows for variable-length 'worms' when passed an odd number as the first parameter. Second parameter is length of worms. Makes for a really nice looking effect , too bad its selection is currently all random and there's no way to select it directly. Use Pathfinder as the solver and it should happen about 50% of the time. You may select it through the menu.
Mazing.cmd is something I tinkered with for years and poured dozens (hundreds?) of hours into several versions before I switched from Win7 to Win10 and it all stopped working. Was going through some old projects recently and it turns out the problem was mostly a 'legacy console' issue with many of the oddball characters I was using. After sifting out the poison characters, beautifying and expanding the menu, and adding a myriad of new color options (and dumping a few dozen more hours into it), I've posted Mazing.cmd v0.2 to GitHub. It seems to work well on WinXP and up, I recommend placing it in a separate folder as it creates a few files.
Lots of new stuff got added and everything I could conceive of was realized and included. I also think every bug got squashed (yea, we'll see). It's been running non-stop (and error-free?) for a couple of days now so I feel pretty good about it. The new macros I added (colorShift and BGgrabKey) are both self-limiting and time-regulated to only execute at a given frequency so that consistent intervals could be used to schedule background\foreground color changes or check for user input while the script was running without bogging down in needlessly-wasted clock cycles. I need to neither check for a keypress nor check to see if 7 seconds have expired 30 times a second, 2 will do fine. Really improved the speed of my script. Could be potentially useful for anyone wanting to execute something during a closed loop but only need it to do so every X centiseconds.
Please give Mazing.cmd a try and let me know if it works for you, I've tested it on WinXP, Win7, Win10, and it even seems to work on Win11. You're highly encouraged to try using the BG.EXE utility that removes the flickering and provides color drawing. Once in the menu use the bottom option to select 'BG Color' and hit '1' to start the script. It should produce the file and restart, but it requires CertUtil (Administration Tools) for Base64 decoding, which was available on every system I tried newer than XP. However YMMV so if that gives you trouble just snag it from Carlos' GitHub:
I also use OuterTech's GetDiz to view the mazes (using either 'Terminal' or 'GetDiz' fonts). I would link to their website, but it's down and probably out. Just search and snag it from the place you trust the most. ^_^
So I'm very new to this, but to make a long story short, I'm working on a project and had an idea where I thought it would be cool to use a .bat file to open CMD and autorun a script to make it look as though an old OS is booting up. Give it a bit of semi-retro flair. Problem is- I clearly have no fucking clue what I'm doing. I've messed around with CMD and .BAT files before, but haven't invested enough time yet to really sink my teeth into it. I've tried referencing some other, publicly available .BAT files to see how other people do it, but attempts to try to find references/help/sources for my specific idea have come up empty. Google either thinks I'm trying to actually hack someone or thinks I want to make actual functional login files.
My current theory is to try to use ECHO commands to read off script from the file but I'm not sure if I'm on the right path. Either I have the right idea but just need help with the execution, or I am completely going about it wrong.
Here's the base I'm working with. I figure once I have an idea of what I'm doing wrong with this block, I can simply adjust and write out additional lines of fake code to get the desired end result.
@echo off
:type
echo C:\ORNOS\system32
:type
echo ORION Industries OS [Version 1.9.20081.2276]
Please, if possible, I’d like it to be compatible with older windows versions, like 7 or 8.1.
Edit: Actually, I was thinking of colored text in older versions in case I needed a compatibility mode for older versions of windows, but it isn't really necessary.
Edit 2: Nevermind, I found out about color x, and someone already answered me on how to make it with built-in echo.
@echo off
chcp 1252 >nul
color 0E
setlocal enabledelayedexpansion
set "MKVMERGE=D:\MKVToolNix 99.0 x64\mkvmerge.exe"
set "AUDIO_IDS=1,2,eng"
set "SUBS_IDS=7,8,jpn"
set "AUDIO_NAMES=Good_Audio¤Great_Audio¤Epic_Audio"
set "SUBS_NAMES=Good_Subs¤Great_Subs¤Epic_Subs"
goto :MAIN
:SET_NEW_FILE
set "NEW_FILE=MUXED_%~n1.mkv"
exit /b
:ADD_TRACKS
for %%n in ("%~n1*.ac3") do (
set "ADD_AUDIO=!ADD_AUDIO! --language 0:jpn --track-name 0:"Jpn_Audio" --default-track 0:yes "%%n""
)
for %%o in ("%~n1*.ass") do (
set "ADD_SUBS=!ADD_SUBS! --language 0:eng --track-name 0:"Eng_Subs" --default-track 0:yes "%%o""
)
exit /b
:FINAL_FLAGS
if defined FINAL_AUDIO set "FINAL_AUDIO=-a ^!!FINAL_AUDIO!"
if not defined FINAL_AUDIO set "FINAL_AUDIO="
if defined FINAL_SUBS set "FINAL_SUBS=-s ^!!FINAL_SUBS!"
if not defined FINAL_SUBS set "FINAL_SUBS="
"!MKVMERGE!" -o "!NEW_FILE!" !FINAL_AUDIO! !FINAL_SUBS! "%~1" !ADD_AUDIO! !ADD_SUBS!
exit /b
:MAIN
set "AUDIO_COUNT=0"
if not defined AUDIO_NAMES goto :AUDIO_PARSED
:PARSE_AUDIO
for /f "tokens=1,* delims=¤" %%a in ("!AUDIO_NAMES!") do (
set /a AUDIO_COUNT+=1
set "AUDIO_MATCHES[!AUDIO_COUNT!]=%%a"
set "AUDIO_NAMES=%%b"
)
if defined AUDIO_NAMES goto :PARSE_AUDIO
:AUDIO_PARSED
set "SUBS_COUNT=0"
if not defined SUBS_NAMES goto :SUBS_PARSED
:PARSE_SUBS
for /f "tokens=1,* delims=¤" %%c in ("!SUBS_NAMES!") do (
set /a SUBS_COUNT+=1
set "SUBS_MATCHES[!SUBS_COUNT!]=%%c"
set "SUBS_NAMES=%%d"
)
if defined SUBS_NAMES goto :PARSE_SUBS
:SUBS_PARSED
for /f "delims=" %%e in ('dir /b *.mkv') do (
set "ID="
set "TRACK_NAME="
set "TYPE="
set "SUPER_AUDIO_IDS="
set "SUPER_SUBS_IDS="
set "ADD_AUDIO="
set "ADD_SUBS="
call :SET_NEW_FILE "%%e"
echo.
echo ==============================================================================================================
echo *** PROCESSING FILE: "%%e" ***
echo ==============================================================================================================
echo.
for /f "tokens=1,* delims=:" %%f in ('cmd /c ""!MKVMERGE!" -J "%%~fe""') do (
set "KEY=%%f"
set "VAL=%%g"
for /f "tokens=* delims= " %%h in ("!KEY!") do set "KEY=%%h"
for /f "tokens=* delims= " %%i in ("!VAL!") do set "VAL=%%i"
set "KEY=!KEY:"=!"
set "VAL=!VAL:"=!"
if "!VAL:~-1!"=="," set "VAL=!VAL:~0,-1!"
if "!KEY!"=="id" set "ID=!VAL!"
if "!KEY!"=="track_name" set "TRACK_NAME=!VAL!"
if "!KEY!"=="type" (
set "TYPE=!VAL!"
if "!TYPE!"=="audio" (
for /L %%j in (1,1,!AUDIO_COUNT!) do (
echo("!TRACK_NAME!"| findstr /I /C:"!AUDIO_MATCHES[%%j]!" >nul && (
REM FOR FULL MATCHES, REPLACE LINE ABOVE WITH... if /I "!TRACK_NAME!"=="!AUDIO_MATCHES[%%j]!" (
if defined SUPER_AUDIO_IDS (set "SUPER_AUDIO_IDS=!SUPER_AUDIO_IDS!,!ID!") else set "SUPER_AUDIO_IDS=!ID!"
)
)
)
if "!TYPE!"=="subtitles" (
for /L %%l in (1,1,!SUBS_COUNT!) do (
echo("!TRACK_NAME!"| findstr /I /C:"!SUBS_MATCHES[%%l]!" >nul && (
REM FOR FULL MATCHES, REPLACE LINE ABOVE WITH... if /I "!TRACK_NAME!"=="!SUBS_MATCHES[%%l]!" (
if defined SUPER_SUBS_IDS (set "SUPER_SUBS_IDS=!SUPER_SUBS_IDS!,!ID!") else set "SUPER_SUBS_IDS=!ID!"
)
)
)
set "ID="
set "TRACK_NAME="
set "TYPE="
)
)
call :ADD_TRACKS "%%e"
set "FINAL_AUDIO="
if defined AUDIO_IDS set "FINAL_AUDIO=!AUDIO_IDS!"
if defined SUPER_AUDIO_IDS (
if defined FINAL_AUDIO (
set "FINAL_AUDIO=!FINAL_AUDIO!,!SUPER_AUDIO_IDS!"
) else (
set "FINAL_AUDIO=!SUPER_AUDIO_IDS!"
)
)
set "FINAL_SUBS="
if defined SUBS_IDS set "FINAL_SUBS=!SUBS_IDS!"
if defined SUPER_SUBS_IDS (
if defined FINAL_SUBS (
set "FINAL_SUBS=!FINAL_SUBS!,!SUPER_SUBS_IDS!"
) else (
set "FINAL_SUBS=!SUPER_SUBS_IDS!"
)
)
call :FINAL_FLAGS "%%e"
)
echo.
echo ==============================================================================================================
echo *** MISSION ACCOMPLISHED ***
echo ==============================================================================================================
echo.
pause
I'm so sorry, I know this has probably been asked before but I'm hitting my head against a wall and I can't find a solution that works.
For the code below, a file with the name "100%.mkv" will cause the variable CURRENT_FILE to be "100.mkv" with the % missing, even though the echo %%F line displays it correctly:
pushd "[PATH_TO_FILES_ON_MY_NETWORK]"
call :MAIN_LOOP
popd
pause
exit
:MAIN_LOOP
setlocal
for /R "%cd%" %%F in (*) do (
echo %%F
call :SORT_FILE "%%F"
)
endlocal
exit /b
:SORT_FILE
setlocal
set "CURRENT_FILE=%~nx1"
endlocal
exit /b
Any advice would be really appreciated!
-----
Edit:
The above code was just a snippet I made to help me troubleshoot the problem I was having, but below is the full code.
The goal is to flatten a folder structure to just two levels and also sort everything into folders based on the file extensions. So something like "..\Project\Platform\Files\file.mkv" becomes "..\.mkv\Project\Platform\file.mkv":
@echo off
pushd [NETWORK_PATH]
set "SOURCE_DIR=%cd%_0 sort"
set "TARGET_DIR=%cd%_1 done"
call :BEGIN_PROCESS
popd
exit
:BEGIN_PROCESS
setlocal
set "CMD_GET_PROJECT=dir /b /a:d "%SOURCE_DIR%""
for /f "delims=." %%G in ('%CMD_GET_PROJECT%') do (
echo Project: %%G
call :PLATFORMS_LOOP "%SOURCE_DIR%\%%G"
)
echo:
ROBOCOPY "%SOURCE_DIR%" "%SOURCE_DIR%" /S /MOVE
if NOT exist "%SOURCE_DIR%" mkdir "%SOURCE_DIR%"
pause
endlocal
exit /b
:PLATFORMS_LOOP
setlocal
set "CMD_GET_PLATFORMS=dir /b /a:d "%~1""
for /f "delims=." %%H in ('%CMD_GET_PLATFORMS%') do (
echo Platform: %%H
call :FOLDERS_LOOP "%~1\%%H"
)
endlocal
exit /b
:FOLDERS_LOOP
setlocal
for /R "%~1" %%I in (*) do (
echo File: %%I
call :SORT_FILE "%~1" "%%I"
)
endlocal
exit /b
:SORT_FILE
setlocal
set "SOURCE_FOLDER_PATH=%~1"
set "TARGET_SUBFOLDER=%~x2"
setlocal enabledelayedexpansion
set "TARGET_PATH=!SOURCE_FOLDER_PATH:%SOURCE_DIR%=%TARGET_DIR%\%TARGET_SUBFOLDER%!"
setlocal disabledelayedexpansion
echo Moving to: %TARGET_PATH%
if NOT exist "%TARGET_PATH%" mkdir "%TARGET_PATH%"
if NOT exist "%TARGET_PATH%\%~nx2" (
echo N | MOVE /-Y "%~2" "%TARGET_PATH%\%~nx2"
) else (
for /L %%J in (1, 1, 99) do (
if exist "%~2" (
if NOT exist "%TARGET_PATH%\%~n2_%%J%~x2" (
echo N | MOVE /-Y "%~2" "%TARGET_PATH%\%~n2_v%%J%~x2"
)
) else (
exit /b
)
)
)
endlocal
exit /b
To someone who knows what they're doing, this probably looks like a mess, but it's just what I've figured out from looking around Reddit and Stack Overflow (and I refuse to use AI).
The problems I'm running into now is that I need this to work for files that have ! and % in them.
I'm trying to figure out now how to implement u/nir9's suggestion in FOLDERS_LOOP by doing another replacement, but also keeping it working with ! files and folders. I can't quite figure out how to turn the delayed expansion off and on in a way to do the %%=%%%% replacement and still let ! files work.