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.
This is an example of using multithreading to display an animation while the main script continues execution. The animation itself is part of my ongoing experimantion with programmable entity behaviours that can be implemented via set /a, and is just 2 'entities' moving through their programmed paths.
xe=(`^=`<<13,`^=`>>17,`^=`<<5,((`&0x7FFFFFFF)%%(_%%i.fH-_%%i.fL+1)))+_%%i.fL ; generate random cd coefficient: xe 'x expiry' Value in range : [ high-low ... + low ]
_%%i.xd=-1*((_%%i.xc-=-1*~((_%%i.xc)>>31))>>31) ; decrease cooldown timer if timer gtr -1 ; flag 'do' true : xd == 1 if cd == -1
_%%i.xc+=_%%i.xd*(xe+1) ; new cd value added from xe if xd == 1
rx=('^='<<13,'^='>>17,'^='<<5,(('&0x7FFFFFFF)%%3+1))-2 ; generate random sign x -1 0 or 1
_%%i.sx=_%%i.xd*rx+((1-_%%i.xd)*_%%i.sx) ; selectively assign new sx if xd == 1
ye=('^='<<13,'^='>>17,'^='<<5,(('&0x7FFFFFFF)%%(_%%i.fH-_%%i.fL+1)))+_%%i.fL ; repeat above logic for y using a different random seed
_%%i.yd=-1*((_%%i.yc-=-1*~((_%%i.yc)>>31))>>31)
_%%i.yc+=_%%i.yd*(ye+1)
ry=(`^=`<<13,`^=`>>17,`^=`<<5,(('&0x7FFFFFFF)%%3+1))-2
_%%i.sy=_%%i.yd*ry+((1-_%%i.yd)*_%%i.sy)
_%%i.x+=_%%i.sx,_%%i.x-=(-1*((_%%i.xH-(_%%i.x+_%%i.w))>>31)),_%%i.x+=(-1*((_%%i.x-_%%i.xL)>>31)) ; increment by ( sx - (1 if x gtr x max) + ( 1 if x lss x min )
_%%i.y+=_%%i.sy,_%%i.y-=(-1*((_%%i.yH-(_%%i.y+_%%i.h))>>31)),_%%i.y+=(-1*((_%%i.y-_%%i.yL)>>31)) ; clamped sign modification as above for y
,... F T reset _#.cd 'rc' if:
rc=-(-1*(-1-((_%%i.sx|_%%i.sy)|-(_%%i.sy|_%%i.sx))))|^ ; 0 | -1 sy,sX == 0,0
-(-1*~((_%%i.xL-_%%i.x)>>31))|^ ; 0 | -1 _#.x == min X
-(-1*((_%%i.xH-(_%%i.x+_%%i.w))>>31)-1)|^ ; 0 | -1 _#.x == max x
-(-1*~((_%%i.yL-_%%i.y)>>31))|^ ; 0 | -1 _#.y == min y
-(-1*((_%%i.yH-(_%%i.y+_%%i.h))>>31)-1) ; 0 | -1 _#.y == max y
_%%i.xc|=rc ; xc | -1 rc == -1
_%%i.yc|=rc ; yc | -1 rc == -1
I was inspired after seeing how graphics can be accomplished in batch. It’s kinda model after a Rolex GMT Master II. Run with the ‘demo’ parameter to see the moon increment every 5 seconds. https://github.com/JerryASNew/BatchWatch/tree/main/Watch
I created a lightweight open-source batch utility called KillWebHelpers that instantly terminates background web helper processes (`msedgewebview2.exe`, `msedge.exe`, `steamwebhelper.exe`) to quickly free up leaked RAM and system handles on Windows.
You can download the script release or review the source code directly here:
The idea behind Banners was to create a decent faux desktop environment using only batch, and no other outside dependencies.
It includes a desktop/main screen, a menu listing options like opening Documents and a shortcut to a Control Panel, or settings app, as well as an automatically populating programs section. The taskbar also serves a purpose too, displaying any processes or apps you've just opened.
It supports "multitasking", having up to five programs available at one time, so when in a native Banners app you can instantly switch to any other open process just by typing the name.
My goal with this project is to see how far I can push Banners; with different apps (I've already wrote an installer for it), features, ect. Since it's already at version 1.0, I'll release it to Github for people to poke around it.
Este jogo além de batch tem alguns vbs para emitir áudio, usa um arquivo .exe para abrir o batch de fonte (só pra ficar bonito), é simples e apresenta arte ASCII mínima (as poucas peças incluídas são estáticas, pois eu não sabia programar nesse nível quando o jogo foi criado), mas é uma experiência completa e tensa. Botei o nome de ASCII Rooms porque foi o primeiro nome que veio na minha cabeça. talvez futuramente eu tente fazer um rooms completamente feito em ascii.
but when i add it to a batch .bat file i instead get
The following usage of the path operator in batch-parameter
substitution is invalid: %~zA Bytes
For valid formats type CALL /? or FOR /?
The syntax of the command is incorrect.
```
while when typed in I get
```
C:\MeteorRepos\remoteapitesting>for %A in (*.zip) do @echo %~fA - %~zA Bytes
C:\MeteorRepos\remoteapitesting\ethernetspeed.zip - 769203 Bytes
```
Before someone tells me all about and lectures me on X Y theory I''l explain the X or the Y whatever order
The goal: I've just got a 10 lines batch script that start
setlocal ENABLEDELAYEDEXPANSION
Which runs a compiler, a few steps in python, and creates (from scratch) a large zip file from a temp folder and then deletes the folder. It's literally 10 lines.
At the end it would be very slick if all I had was a line that prints the size of the zip file. Any hints what's borked in my very n00b interpretation of the runes for DOS, this is the first ever DOS loop I've written that was not straight-up copy-pasta.
So basically this is meant to emulate movement rather than literally make movement so I dont need help mostly with the concept rather how can I optimize the if's and replace them with for loops instead
echo off
goto :locationvalue
:locationvalue
set /a screenloc=0
set scr=xooooo oxoooo ooxooo oooxoo ooooxo ooooox
goto :main
:main
call :display
ping [127.0.0.1](http://127.0.0.1) \-n 1 -w 500 > NUL
choice /c AD > NUL
if %errorlevel%==1 call :A
if %errorlevel%==2 call :D
goto :main
:A
if %screenloc%==0 goto :eof
set /a screenloc=%screenloc%-1
goto:eof
:D
if %screenloc%==5 goto :eof
set /a screenloc=%screenloc%+1
goto:eof
:display
cls
if %screenloc%==0 echo %scr:\~0,6%
if %screenloc%==1 echo %scr:\~7,6%
if %screenloc%==2 echo %scr:\~14,6%
if %screenloc%==3 echo %scr:\~21,6%
if %screenloc%==4 echo %scr:\~28,6%
if %screenloc%==5 echo %scr:\~35,6%
Animated-Clock contains everything needed to implement a game engine. Indeed, The core requirement, non-blocking input via interprocess communication has origins in the batch snake game by Dave Benham of Dostips renown. (RIP dostips). It also contains a Sound system, an asset manager that demonstrates downloading assets with a Convention of consent and a Configuartion Handler that allows viewing or removal of the scripts persistence data or on demand removal of the temp files the script generates.
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!
to randomly copy 4000 files from one location to another and it all worked fine on my old laptop. Now I am using a new computer and it is not working anymore. Nothing happens. Window opens for a second and closes right away without doing anything.
For testing reasons, I created one folder on my desktop, put in 3 textfiles and changed the code to randomly copy one of the three to a second desktop folder, also no success.
Can you help me? Is there anything I need to change in settings. The code should be fine. I have other batch files on this laptop that work without problems (like opening a specific folder on system start).
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!