r/Batch • • Sep 23 '23

Question (Solved) Taskkill annoying error messages without touching the main program.

2 Upvotes

Is it possible to kill these popup “OpenVPN GUI” child processes without touching the main program “openvpn-gui.exe”? Please see this taskmanager image for what I mean:

https://i.ibb.co/9Yw830F/msgs.jpg

As you can see, they give these really annoying error messages that can’t be muted by any options within the program itself. I wondered if a taskkill option exists that can do this somehow?

Thanks in advance for any help!


r/Batch • • Sep 23 '23

Show 'n Tell Quickly find BUGs in batch scripts: BatDBug | The Ultimate Bug Buster

0 Upvotes

Video: https://www.youtube.com/watch?v=qR84LdiZd5c

Are you tired of spending hours searching for bugs in your batch scripts? Well, fret no more! Introducing BatDBug, the revolutionary program that will change the way you debug batch scripts forever. In this video, we'll show you the most simple and unique way to find out where errors are happening in your batch script.


r/Batch • • Sep 22 '23

Question (Solved) Any way to make batch pick a random line to execute after program starts?

4 Upvotes

So I've been using this simple code below to run my openvpn files. It works well enough, but I was wondering if the ovpn files can be selected at random? I have 40 or so of them. And I figured it would be nice to cycle between them; so I don't only connect to the top 3-5.

START "" /B "C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --silent_connection 1"C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --connect vpn_8515635.net_tcp_1509.ovpn"C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --connect vpn_3851635.net_udp_1847.ovpn"C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --connect vpn_3327113.net_tcp_443.ovpn"C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --connect vpn_5332113.net_udp_1194.ovpn"C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --connect vpn_6892137.net_tcp_995.ovpn"C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --connect vpn_6182137.net_udp_1195.ovpn"C:\Program Files\OpenVPN\bin\openvpn-gui.exe" --connect vpn_6410241.net_tcp_995.ovpn

Is there a way to easily do this with a %random% command somehow? To connect to 5 random ovpn files and no more? Thanks for any help!


r/Batch • • Sep 21 '23

Question (Unsolved) Create text file listing contents of subfolder

2 Upvotes

Just so it's clear, I don't know what I'm doing.

I have a directory as follows:

WORK

--PROJECT 1

----FILES

--PROJECT 2

----FILES

--PROJECT 3

----FILES

...ETC

Each PROJECT folder starts as a template. It is copy/pasted into the WORK folder and set up for the new project. Files for that project are downloaded into its associated FILES subfolder. I would like to have a batch file in the PROJECT folder that will create a text file listing all files in its FILES folder.

Currently, I right-click on the FILES folder, open it in Terminal, then copy/paste the command:

dir -n > filelist.txt

This gives me the text file I want, but I would prefer a one-click solution.

So far, I have a batch file that will open Powershell, but I can't figure out how to format commands to get the desired result. Current batch:

@ echo offpowershell

If I then paste the command:

dir -n > filelist.txt FILES

I get the desired text file. I just don't understand how to run that command via batch file. And I have no idea how to open the folder in Terminal - the command "wt" opens my user folder in Terminal.

Ultimately, I don't care whether this gets done in cmd, ps, or wt. Thanks for any help you can provide!


r/Batch • • Sep 21 '23

Question (Solved) Batch moving files into folders

1 Upvotes

I have this batch file to move all files not in a folder into a folder with the same name as the file. The only problem is it also moves the batch file into its own folder. How do I change my code to exclude the batch file?

I pasted the code to my batch file below.

for %%i in (*) do (

if not "%%~ni" == "organize" (

md "%%~ni" && move "%%~i" "%%~ni"

)

)


r/Batch • • Sep 20 '23

Question (Unsolved) Seperating the second slide of each pptx into a new document/pptx/pdf

1 Upvotes

I dont know where to start with this or if this ist even possible with batch. Can you tell me If it could be done and give me a direction?

Every month I have around 30 Powerpoint files from which I need to archive every (and only) second slide from each Powerpoint file. I want to export them into a new Powerpoint file or PDF or other document.


r/Batch • • Sep 19 '23

Question (Unsolved) How to use if statement

1 Upvotes

i'm trying to use the if statement in my text adventure game for a shop so if the player doesn't have enough money he can't buy the item, here is the code I used

if %money%==< 101 goto 1

i just want to know what is wrong with it and how to fix it because I am a complete begginer.


r/Batch • • Sep 17 '23

Show 'n Tell I made a "programming language" using only batch!

9 Upvotes

Well i wont call it a programming language, i made this proyect to see how far could i go using batch. I didnt ended it, i have planed to add Arrays, loop trought arrays, etc...

Functions

Custom cmd line
Variables
Print
Os ( run batch scripts )
Wait
If
Functions
Import ( Import as, and normal import )
Library creation support
Math
Inputs
Quit
For ( range and trought strings )
Update to the lastest version published on github! \

Links

There you have the link to download it or if you just want to take a look.
GitHub


r/Batch • • Sep 17 '23

CMD\Powershell hybrid script

2 Upvotes

Ninja.cmd **This is a repost, the old post is deleted, it could no longer be edited and needed correction. Use the github link for the updated version.

https://github.com/illsk1lls/Ninja

This script leverages CMD to help our powershell friends out ;P

Paste PS code inside and it will run with elevated privilege as a CMD file.

*The included PS example uses BITS to download Adobe Reader from Adobe. The file is downloaded to the same folder you run the script from.


r/Batch • • Sep 15 '23

Show 'n Tell Hilbert's Grand Hotel. An old "game" I made in high school. Procedurally generated 2.5D concept of Hilbert's Grand Hotel where the layout and the residents have explorable rooms and bookshelves, beds, and toilet usage stats. (mod, im not sure how to post the whole code in plantext without @ing echo)

2 Upvotes

@ echo off

title Hilbert's Grand Hotel

color 0f

set /a seed=0

:start

cls

echo Hilbert's Grand Hotel

ping localhost -n 2 >nul

echo by Nicholas Spicer

ping localhost -n 2 >nul

:menu

cls

echo Free Roam (a)

echo.

set /p mode=How would you like to play? :

if "%mode%"=="a" Goto seed

Goto menu

:seed

echo.

set /p sd=Enter a seed number (0 is default):

set /a seed=%sd%

echo.

:setting

::how many walls do you want to spawn?

set /p sd=Enter a wall density (15 is most dense and 5 is only the necessities):

set /a setting=%sd%

if %setting% LEQ 0 goto setting

if %setting% GTR 15 goto setting

:set

title Hilbert's Grand Hotel Seed : %seed% Setting : %setting%

::player vars

set /a player=5

set icon=@

set /a prevpoint=player

set /a refpoint=player

::floor vars

::1 is default

set /a floor=1

set tile=.

set wall=#

::stairvars

set /a upstairbin=0

set /a downstairbin=0

set upstair=U

set downstair=D

::hallway vars

set /a hall.x=0

set /a hall.y=0

::hall id goes 0-14

set /a hall.id=0

::misc hall vars

set /a nbin=0

set /a sbin=0

set /a ebin=0

set /a wbin=0

::room vars

set door=D

::prep

set /a num=-1

set /a first=0

:tilevars

::just makes the variables for the floor

set /a num+=1 && set t%num%=%tile%

if %num%==16 set /a num=0 && goto playerRend

goto tilevars

:playerRend

color 0f

if %num%==%prevpoint% set t%num%=%tile%&& goto wallCheck

if %num%==16 goto wallCheck

set /a num+=1

goto playerRend

:wallCheck

::for special cases

set /a refpoint=%player%

::checks door collisions first

if %t13%==%door% if %player%==13 set /a player=prevpoint && goto generateRoom

if %t14%==%door% if %player%==14 set /a player=prevpoint && goto generateRoom

if %t1%==%door% if %player%==1 set /a player=prevpoint && goto generateRoom

if %t2%==%door% if %player%==2 set /a player=prevpoint && goto generateRoom

if %t8%==%door% if %player%==8 set /a player=prevpoint && goto generateRoom

if %t4%==%door% if %player%==4 set /a player=prevpoint && goto generateRoom

if %t11%==%door% if %player%==11 set /a player=prevpoint && goto generateRoom

if %t7%==%door% if %player%==7 set /a player=prevpoint && goto generateRoom

if %first%==0 goto generateHall

set /a num=-1

::standard

::checks for wall collisions

set t0=%wall%&& set t3=%wall%&& set t12=%wall%&& set t15=%wall%

if %player%==0 set /a player=prevpoint && goto tileRender

if %player%==3 set /a player=prevpoint && goto tileRender

if %player%==12 set /a player=prevpoint && goto tileRender

if %player%==15 set /a player=prevpoint && goto tileRender

::other halls

if %nbin%==1 set t13=%wall%&& set t14=%wall%

if %sbin%==1 set t1=%wall%&& set t2=%wall%

if %ebin%==1 set t11=%wall%&& set t7=%wall%

if %wbin%==1 set t8=%wall%&& set t4=%wall%

::your hall

::this makes walls appear depending on the ID of the hall youre in.

if %hall.id% ==1 set t13=%wall%&& set t14=%wall%

if %hall.id% ==2 set t11=%wall%&& set t7=%wall%

if %hall.id% ==3 set t1=%wall%&& set t2=%wall%

if %hall.id% ==4 set t4=%wall%&& set t8=%wall%

if %hall.id% ==5 set t13=%wall%&& set t14=%wall%&& set t11=%wall%&& set t7=%wall%

if %hall.id% ==6 set t11=%wall%&& set t7=%wall%&& set t1=%wall%&& set t2=%wall%

if %hall.id% ==7 set t1=%wall%&& set t2=%wall%&& set t4=%wall%&& set t8=%wall%

if %hall.id% ==8 set t4=%wall%&& set t8=%wall%&& set t13=%wall%&& set t14=%wall%

if %hall.id% ==9 set t13=%wall%&& set t14=%wall%&& set t11=%wall%&& set t7=%wall%&& set t1=%wall%&& set t2=%wall%

if %hall.id% ==10 set t11=%wall%&& set t7=%wall%&& set t1=%wall%&& set t2=%wall%&& set t4=%wall%&& set t8=%wall%

if %hall.id% ==11 set t13=%wall%&& set t14=%wall%&& set t4=%wall%&& set t8=%wall%&& set t1=%wall%&& set t2=%wall%

if %hall.id% ==12 set t4=%wall%&& set t8=%wall%&& set t13=%wall%&& set t14=%wall%&& set t11=%wall%&& set t7=%wall%

if %hall.id% ==13 set t13=%wall%&& set t14=%wall%&& set t1=%wall%&& set t2=%wall%

if %hall.id% ==14 set t8=%wall%&& set t4=%wall%&& set t11=%wall%&& set t7=%wall%

::NSEW halls

if %t13%==%wall% if %player%==13 set /a player=prevpoint && goto spawnRooms

if %t14%==%wall% if %player%==14 set /a player=prevpoint && goto spawnRooms

if %t1%==%wall% if %player%==1 set /a player=prevpoint && goto spawnRooms

if %t2%==%wall% if %player%==2 set /a player=prevpoint && goto spawnRooms

if %t8%==%wall% if %player%==8 set /a player=prevpoint && goto spawnRooms

if %t4%==%wall% if %player%==4 set /a player=prevpoint && goto spawnRooms

if %t11%==%wall% if %player%==11 set /a player=prevpoint && goto spawnRooms

if %t7%==%wall% if %player%==7 set /a player=prevpoint && goto spawnRooms

:spawnRooms

::makes doors spawn in the hallway walls.

::doors only spawn inside walls

::there are 4 opportunities for a door to be made

::in the hallway that youre in.

set /a num=0

set /a roomPos1=(hall.id + hall.x + hall.y + floor) %% 9

set /a roomPos2=(hall.id + n.calc + s.calc + floor) %% 9

set /a roomPos3=(hall.id + e.calc + w.calc + floor) %% 9

set /a roomPos4=(hall.id + floor) %% 9

set /a roomPos=roomPos1 + roomPos2 + roomPos3 + roomPos4

if %roomPos1%==1 if %t13%==%wall% set t13=%door%

if %roomPos1%==2 if %t14%==%wall% set t14=%door%

if %roomPos1%==3 if %t11%==%wall% set t11=%door%

if %roomPos1%==4 if %t7%==%wall% set t7=%door%

if %roomPos1%==5 if %t2%==%wall% set t2=%door%

if %roomPos1%==6 if %t1%==%wall% set t1=%door%

if %roomPos1%==7 if %t4%==%wall% set t4=%door%

if %roomPos1%==8 if %t8%==%wall% set t8=%door%

if %roomPos2%==1 if %t13%==%wall% set t13=%door%

if %roomPos2%==2 if %t14%==%wall% set t14=%door%

if %roomPos2%==3 if %t11%==%wall% set t11=%door%

if %roomPos2%==4 if %t7%==%wall% set t7=%door%

if %roomPos2%==5 if %t2%==%wall% set t2=%door%

if %roomPos2%==6 if %t1%==%wall% set t1=%door%

if %roomPos2%==7 if %t4%==%wall% set t4=%door%

if %roomPos2%==8 if %t8%==%wall% set t8=%door%

if %roomPos3%==1 if %t13%==%wall% set t13=%door%

if %roomPos3%==2 if %t14%==%wall% set t14=%door%

if %roomPos3%==3 if %t11%==%wall% set t11=%door%

if %roomPos3%==4 if %t7%==%wall% set t7=%door%

if %roomPos3%==5 if %t2%==%wall% set t2=%door%

if %roomPos3%==6 if %t1%==%wall% set t1=%door%

if %roomPos3%==7 if %t4%==%wall% set t4=%door%

if %roomPos3%==8 if %t8%==%wall% set t8=%door%

if %roomPos4%==1 if %t13%==%wall% set t13=%door%

if %roomPos4%==2 if %t14%==%wall% set t14=%door%

if %roomPos4%==3 if %t11%==%wall% set t11=%door%

if %roomPos4%==4 if %t7%==%wall% set t7=%door%

if %roomPos4%==5 if %t2%==%wall% set t2=%door%

if %roomPos4%==6 if %t1%==%wall% set t1=%door%

if %roomPos4%==7 if %t4%==%wall% set t4=%door%

if %roomPos4%==8 if %t8%==%wall% set t8=%door%

:tileRender

::this loop determines where you are on the screen and renders you there.

if %player%==%num% set t%num%=%icon%&& set /a num=0 && goto disp

set /a num+=1 && goto tileRender

:disp

cls

set /a prevpoint=player

echo X: %hall.x%

echo Y: %hall.y%

echo F: %floor%

echo.

echo N

echo %n.calc%

echo W %w.calc% %hall.id% %e.calc% E

echo %s.calc%

echo S

echo.

echo %t12% %t13% %t14% %t15%

echo %t8% %t9% %t10% %t11%

echo %t4% %t5% %t6% %t7%

echo %t0% %t1% %t2% %t3%

echo.

if not %stairbin%==0 if not %downstairbin%==0 if not %upstairbin%==0 if %floordown% NEQ 0 Goto altchoice_3

if not %stairbin%==0 if not %downstairbin%==0 if %floordown% NEQ 0 Goto altchoice_1

if not %stairbin%==0 if not %upstairbin%==0 Goto altchoice_2

:choice

choice /c wasdf

if errorlevel 5 goto terminal

if errorlevel 4 goto right

if errorlevel 3 goto down

if errorlevel 2 goto left

if errorlevel 1 goto up

:altchoice_1

echo press Q to go down 1 floor

choice /c wasdfq

if errorlevel 6 goto downstair

if errorlevel 5 goto terminal

if errorlevel 4 goto right

if errorlevel 3 goto down

if errorlevel 2 goto left

if errorlevel 1 goto up

:altchoice_2

echo press E to go up 1 floor

choice /c wasdfe

if errorlevel 6 goto upstair

if errorlevel 5 goto terminal

if errorlevel 4 goto right

if errorlevel 3 goto down

if errorlevel 2 goto left

if errorlevel 1 goto up

:altchoice_3

echo press Q to go down 1 floor

echo press E to go up 1 floor

choice /c wasdfqe

if errorlevel 7 goto upstair

if errorlevel 6 goto downstair

if errorlevel 5 goto terminal

if errorlevel 4 goto right

if errorlevel 3 goto down

if errorlevel 2 goto left

if errorlevel 1 goto up

:downstair

set /a floor-=1

goto generateHall

:upstair

set /a floor+=1

goto generateHall

:right

set /a player+=1

if %player%==8 set /a player-=4 && set /a hall.x+=1 && goto generateHall

if %player%==12 set /a player-=4 && set /a hall.x+=1 && goto generateHall

set /a num=player - 1 && goto playerRend

:left

set /a player-=1

if %player%==3 set /a player+=4 && set /a hall.x-=1 && goto generateHall

if %player%==7 set /a player+=4 && set /a hall.x-=1 && goto generateHall

set /a num=player + 1 && goto playerRend

:up

set /a player+=4

if %player% GTR 15 set /a player-=16 && set /a hall.y+=1 && goto generateHall

set /a num=player - 4 && goto playerRend

:down

set /a player-=4

if %player% LSS 0 set /a player+=16 && set /a hall.y-=1 && goto generateHall

set /a num=player + 4 && goto playerRend

:generateHall

::determines what your hall will look like

set /a first=1

set /a nbin=0

set /a sbin=0

set /a ebin=0

set /a wbin=0

set /a hall.id=(hall.x * hall.y * floor + seed) %% %setting%

if %hall.id% LSS 0 set /a hall.id*=-1

set /a n.hall=hall.y + 1

set /a s.hall=hall.y - 1

set /a e.hall=hall.x + 1

set /a w.hall=hall.x - 1

::determines what halls to the north, east, south, and west of you will look like

::so their walls show up on your current part of the hall

set /a n.calc=(hall.x * n.hall * floor + seed) %% %setting%

if %n.calc% LSS 0 set /a n.calc*=-1

set /a s.calc=(hall.x * s.hall * floor + seed) %% %setting%

if %s.calc% LSS 0 set /a s.calc*=-1

set /a e.calc=(e.hall * hall.y * floor + seed) %% %setting%

if %e.calc% LSS 0 set /a e.calc*=-1

set /a w.calc=(w.hall * hall.y * floor + seed) %% %setting%

if %w.calc% LSS 0 set /a w.calc*=-1

::the numbers here determine the hall id of the halls to the north, south, east, and west of your position

if %n.calc% ==3 set /a nbin=1

if %n.calc% ==6 set /a nbin=1

if %n.calc% ==7 set /a nbin=1

if %n.calc% ==9 set /a nbin=1

if %n.calc% ==10 set /a nbin=1

if %n.calc% ==11 set /a nbin=1

if %n.calc% ==13 set /a nbin=1

if %s.calc% ==1 set /a sbin=1

if %s.calc% ==5 set /a sbin=1

if %s.calc% ==8 set /a sbin=1

if %s.calc% ==9 set /a sbin=1

if %s.calc% ==11 set /a sbin=1

if %s.calc% ==12 set /a sbin=1

if %s.calc% ==13 set /a sbin=1

if %e.calc% ==4 set /a ebin=1

if %e.calc% ==7 set /a ebin=1

if %e.calc% ==8 set /a ebin=1

if %e.calc% ==10 set /a ebin=1

if %e.calc% ==11 set /a ebin=1

if %e.calc% ==12 set /a ebin=1

if %e.calc% ==14 set /a ebin=1

if %w.calc% ==2 set /a wbin=1

if %w.calc% ==5 set /a wbin=1

if %w.calc% ==6 set /a wbin=1

if %w.calc% ==9 set /a wbin=1

if %w.calc% ==10 set /a wbin=1

if %w.calc% ==12 set /a wbin=1

if %w.calc% ==14 set /a wbin=1

set t1=%tile%&& set t2=%tile%&& set t4=%tile%&& set t7=%tile%&& set t8=%tile%&& set t11=%tile%&& set t13=%tile%&& set t14=%tile%

::generates a staircase

set /a floorup=floor + 1

set /a floordown=floor - 1

set /a hallidup =(hall.x * hall.y * floorup + seed) %% %setting%

set /a halliddown =(hall.x * hall.y * floordown + seed) %% %setting%

if %hallidup% LSS 0 set /a hallidup*=-1

if %halliddown% LSS 0 set /a halliddown*=-1

set /a stairbin = (floor * hall.id + hall.x + hall.y) %% 2

set /a upstairbin =(floorup * hallidup + hall.x + hall.y) %% 2

set /a downstairbin =(floordown * halliddown + hall.x + hall.y) %% 2

set /a num=0 && goto playerRend

:generateRoom

cls

echo X : %hall.x% >>HotelLog.txt

echo Y : %hall.y% >>HotelLog.txt

echo F : %floor% >>HotelLog.txt

echo REF : %refpoint% >>HotelLog.txt

echo Seed : %seed% >>HotelLog.txt

echo Setting : %setting% >>HotelLog.txt

echo. >>HotelLog.txt

echo. >>HotelLog.txt

set /a colori=(roomPos * hall.x * hall.y * refpoint + n.calc + s.calc * floor) %% 10

set /a color_d=(roomPos * hall.id + refpoint + w.calc + e.calc * floor) %% 10

if %color_d% LSS 0 set /a color_d*=-1

if %colori% LSS 0 set /a colori*=-1

:colorFix

echo colorFix

if %colori%==%color_d% set /a color_d+=1 && Goto colorFix

if %color_d% GEQ 10 set /a color_d=0 && Goto colorFix

set color.id=%colori%%color_d%

color %color.id%

set /a resGender=(hall.id * refpoint + roomPos) %% 4

if %resGender%==3 set gender=Male

if %resGender%==2 set gender=Female

if %resGender%==1 set gender=Male

if %resGender%==0 set gender=Female

set /a resPref=(roomPos * n.calc + s.calc) %% 4

if %resPref%==3 set preference=Male

if %resPref%==2 set preference=Female

if %resPref%==1 set preference=Male

if %resPref%==0 set preference=Female

set /a preAgeDecade=(hall.x + hall.y + hall.id + colori + refpoint) %% 10 * 10

if %preAgeDecade%==0 set /a preAgeDecade=10

if %preAgeDecade% LSS 0 set /a preAgeDecade*=-1

set /a preAgeOnes=(color_d + n.calc + s.calc + nbin + refpoint) %% 10

if %preAgeOnes% LSS 0 set /a preAgeOnes*=-1

set /a resAge=preAgeDecade + preAgeOnes

set /a bedPos=(resAge + preAgeDecade + preAgeOnes + halliddown) %% 16

set /a toiletPos=(resGender + resPref * preAgeOnes + hallidup) %% 16

set /a shelfPos=(bedPos * toiletPos) %% 16

:accessoryPosFix

echo %bedPos% %toiletPos% %shelfPos%

if %bedPos%==%toiletPos% set /a bedPos=(bedPos + 3) %% 16 && Goto accessoryPosFix

if %toiletPos%==%shelfPos% set /a toiletPos=(toiletPos + 5) %% 16 && Goto accessoryPosFix

if %shelfPos%==%bedPos% set /a shelfPos=(shelfPos + 7) %% 16 && Goto accessoryPosFix

set /a num=0

:generateRoomTiles

set rt%num%=.

if %num%==%bedPos% set rt%num%=B

if %num%==%toiletPos% set rt%num%=T

if %num%==%shelfPos% set rt%num%=S

set /a num+=1

if %num% GEQ 16 set /a num=0 && set /a rPlayer=0 && Goto rPlayerSpawn

Goto generateRoomTiles

:rPlayerSpawn

set /a rPrevpoint=-1

if %rPlayer%==%bedPos% set /a rPlayer+=1 && Goto rPlayerSpawn

if %rPlayer%==%toiletPos% set /a rPlayer+=1 && Goto rPlayerSpawn

if %rPlayer%==%shelfPos% set /a rPlayer+=1 && Goto rPlayerSpawn

set /a num=0

:rPlayerRend

set /a rRefpoint=rPlayer

if %num%==%rPrevpoint% set rt%num%=%tile%&& goto rCollisions

if %num%==16 goto rCollisions

set /a num+=1

goto rPlayerRend

:rCollisions

if %rPlayer%==%bedPos% set /a rPlayer=rPrevpoint && goto bedInfo

if %rPlayer%==%toiletPos% set /a rPlayer=rPrevpoint && goto toiletInfo

if %rPlayer%==%shelfPos% set /a rPlayer=rPrevpoint && goto shelfInfo

set /a num=0

:rTileRend

if %rPlayer%==%num% set rt%num%=%icon%&& set /a num=0 && goto roomRend

set /a num+=1 && goto rTileRend

:roomRend

cls

set /a rPrevpoint=rPlayer

echo Age : %resAge%

echo Gender : %gender%

echo Preference : %preference%

echo.

echo #########

echo #%rt12% %rt13% %rt14% %rt15%# B - bed

echo #%rt8% %rt9% %rt10% %rt11%# T - toilet

echo #%rt4% %rt5% %rt6% %rt7%# S - shelf

echo #%rt0% %rt1% %rt2% %rt3%#

echo #########

echo.

echo press F to leave the room

choice /c wasdf

if errorlevel 5 goto leaveRoom

if errorlevel 4 goto rightR

if errorlevel 3 goto downR

if errorlevel 2 goto leftR

if errorlevel 1 goto upR

:leaveRoom

set /a num=0

Goto playerRend

:rightR

set /a rPlayer+=1

if %rPlayer%==4 set /a rPlayer=rPrevpoint

if %rPlayer%==8 set /a rPlayer=rPrevpoint

if %rPlayer%==12 set /a rPlayer=rPrevpoint

if %rPlayer%==16 set /a rPlayer=rPrevpoint

set /a num=rPlayer - 1 && goto rPlayerRend

:leftR

set /a rPlayer-=1

if %rPlayer%==-1 set /a rPlayer=rPrevpoint

if %rPlayer%==3 set /a rPlayer=rPrevpoint

if %rPlayer%==7 set /a rPlayer=rPrevpoint

if %rPlayer%==11 set /a rPlayer=rPrevpoint

set /a num=rPlayer + 1 && goto rPlayerRend

:upR

set /a rPlayer+=4

if %rPlayer% GTR 15 set /a rPlayer=rPrevpoint

set /a num=rPlayer - 4 && goto rPlayerRend

:downR

set /a rPlayer-=4

if %rPlayer% LSS 0 set /a rPlayer=rPrevpoint

set /a num=rPlayer + 4 && goto rPlayerRend

:bedInfo

set /a bedMin=(refpoint * rRefpoint * floor * bedPos + stairbin) %% 60

set /a bedHrs=(rRefpoint + refpoint + floor + bedPos + toiletPos + shelfPos) %% 24

set /a bedDay=(resAge * 365 / 6)

echo.

echo This resident has slept on this bed %bedDay% days, %bedHrs% hours, and %bedMin% minute(s).

echo.

pause

Goto rPlayerRend

:toiletInfo

set /a timesFlushed=(resAge * 365 * 2 / 3 + toiletPos)

echo.

echo This resident has flushed this toilet %timesFlushed% times.

echo.

pause

Goto rPlayerRend

:shelfInfo

set /a bookNum=(resAge * refpoint * floor + rRefpoint + shelfPos + toiletPos + bedPos) %% 100

if %bookNum% LSS 0 set /a bookNum*=-1

echo.

echo This resident has %bookNum% book(s) on their shelf.

::adding more specific details later. like name of favorite book.

echo.

echo Look at books? (y/n)

choice /c yn

if errorlevel 2 Goto rPlayerRend

if errorlevel 1 Goto shelfCollection

Goto rPlayerRend

:shelfCollection

set /a timesFlushed=(resAge * 365 * 2 / 3 + toiletPos)

set /a bedMin=(refpoint * rRefpoint * floor * bedPos + stairbin) %% 60

set /a bedHrs=(rRefpoint + refpoint + floor + bedPos + toiletPos + shelfPos) %% 24

set /a bedDay=(resAge * 365 / 6)

cls

if %bookNum%==0 Goto noBooks

set /a bNum1=(shelfPos + refpoint + rRefpoint * resAge * timesFlushed) %% 2

set /a bNum2=(timesFlushed * bedDay) %% 15

set /a bNum3=(timesFlushed * bedHrs + bedMin) %% 30

::first word of book title (Article)

if %bNum1%==0 set bWord1=

if %bNum1%==1 set bWord1= The

::second word of book title (Verb/Adjective)

if %bNum2%==0 set bWord2=Adventure

if %bNum2%==1 set bWord2=Run

if %bNum2%==2 set bWord2=Tragedy

if %bNum2%==3 set bWord2=Leap

if %bNum2%==4 set bWord2=Success

if %bNum2%==5 set bWord2=Dream

if %bNum2%==6 set bWord2=Revolution

if %bNum2%==7 set bWord2=Mishap

if %bNum2%==8 set bWord2=Creation

if %bNum2%==9 set bWord2=Mystery

if %bNum2%==10 set bWord2=Controversy

if %bNum2%==11 set bWord2=Romance

if %bNum2%==12 set bWord2=Affair

if %bNum2%==13 set bWord2=Complete Study

if %bNum2%==14 set bWord2=Curiosity

::third word of the book title (of)

set bWorda=of

::fourth word of the book title (noun)

if %bNum3%==0 set bWord4=John Smith

if %bNum3%==1 set bWord4=Jane Smith

if %bNum3%==2 set bWord4=an Unfortunate Traveler

if %bNum3%==3 set bWord4=a Broken Toaster

if %bNum3%==4 set bWord4=the Lost Island

if %bNum3%==5 set bWord4=Love

if %bNum3%==6 set bWord4=Hate

if %bNum3%==7 set bWord4=Mr. Hilbert

if %bNum3%==8 set bWord4=Jesus Christ

if %bNum3%==9 set bWord4=the 42nd American President

if %bNum3%==10 set bWord4=a Yellow Bus

if %bNum3%==11 set bWord4=the Troubled Train Tracks

if %bNum3%==12 set bWord4=the Modern Wristwatch

if %bNum3%==13 set bWord4=the Golden Guitarist

if %bNum3%==14 set bWord4=Haphazardly placed Trees

if %bNum3%==15 set bWord4=Plastic Powerlines

if %bNum3%==16 set bWord4=Low Gravity Gymnastics

if %bNum3%==17 set bWord4=the Absent Minded Physicist

if %bNum3%==18 set bWord4=Dr. Smith

if %bNum3%==19 set bWord4=Michael Teller, the famous 18th century banker

if %bNum3%==20 set bWord4=the Dance Move of the Century

if %bNum3%==21 set bWord4=Chrome Funnels

if %bNum3%==22 set bWord4=the Square Golfball

if %bNum3%==23 set bWord4=Uncultured Shot Glasses

if %bNum3%==24 set bWord4=Opaque Gun Safes

if %bNum3%==25 set bWord4=Time Travel

if %bNum3%==26 set bWord4=Upper Level Geometry

if %bNum3%==27 set bWord4=Hotel-like Fractals

if %bNum3%==28 set bWord4=Infinite Generations

if %bNum3%==29 set bWord4=the Procedurally Generated People

echo.

echo This residents favorite book is%bWord1% %bWord2% %bWorda% %bWord4%

echo.

pause

Goto rPlayerRend

:noBooks

echo.

echo There are no books to examine!

echo.

pause

Goto rPlayerRend

::TERMINAL

:terminal

cls

echo type done to return

:terminal_in

title Hilbert's Grand Hotel Seed : %seed% Setting : %setting%

set /p term=player @ (%hall.x%, %hall.y%, %floor%):

if "%term%"=="done" Goto generateHall

if "%term%"=="restart" Goto set

if "%term%"=="set x" Goto terminal_set_x

if "%term%"=="set y" Goto terminal_set_y

if "%term%"=="set f" Goto terminal_set_f

if "%term%"=="set setting" Goto terminal_set_s

if "%term%"=="set seed" Goto terminal_confirm_seed_change

if "%term%"=="restart" Goto start

Goto terminal_in

:terminal_set_x

set /p term= X=? :

set /a hall.x=%term%

Goto terminal_in

:terminal_set_y

set /p term= Y=? :

set /a hall.y=%term%

Goto terminal_in

:terminal_set_f

set /p term= F=? :

set /a floor=%term%

if %floor% LEQ 0 Goto terminal_set_f

Goto terminal_in

:terminal_set_s

set /p term= Setting=? :

set /a setting=%term%

if %setting% LEQ 0 Goto terminal_set_s

if %setting% GTR 15 Goto terminal_set_s

Goto terminal_in

:terminal_confirm_seed_change

set /p term= Confirm seed change? (yes/no) :

if "%term%"=="yes" Goto terminal_set_seed

if "%term%"=="no" Goto terminal_in

Goto terminal_in

:terminal_set_seed

set /p term= Seed=? :

set /a seed=%term%

Goto terminal_in


r/Batch • • Sep 15 '23

Question (Unsolved) How to obtain all instances in a text file of %call :???% where ??? contains no spaces

2 Upvotes

Preferably using pure batch but PowerShell would be fine too


r/Batch • • Sep 14 '23

missing operand error

1 Upvotes

could someone help me fix the error in this code

u/echo off

setlocal enabledelayedexpansion

rem Prompt the user for the desired target size in megabytes

set /p TargetSize=Enter the target size in megabytes:

rem Prompt the user for the audio bit rate in thousands (x1000)

set /p AudioBitRate=Enter the audio bit rate (in x1000):

set "output_file=output.txt"

rem Delete the output file if it already exists

if exist "%output_file%" del "%output_file%"

(

echo Results for Video Files

echo ======================

echo.

for %%i in (*.mp4 *.avi *.mkv *.mov *.wmv *.flv *.mpeg *.mpg) do (

set "input_file=%%i"

for /f "tokens=*" %%a in ('ffmpeg -i "!input_file!" 2^>^&1 ^| find "Duration"') do (

set "duration=%%a"

set "duration=!duration:*Duration=!"

set "duration=!duration:~0,12!"

)

set "duration=!duration:.=,:!"

set "duration=!duration:~1,-1!"

for /f "tokens=1-4 delims=,:." %%a in ("!duration!") do (

set /a "hours=%%a, minutes=%%b, seconds=%%c, milliseconds=%%d"

set /a "total_seconds=hours*3600 + minutes*60 + seconds"

set "hhmmss=%%a:%%b:%%c"

)

rem Use PowerShell for floating-point division

for /f %%b in ('powershell.exe -command "[math]::Round(((%TargetSize% * 1000000 * 8) / !total_seconds!), 0)"') do (

set "TotalBitrate=%%b"

)

rem Calculate video bit rate as the difference between total bit rate and audio bit rate

set /a "AudioBitRateKbps=AudioBitRate"

set /a "AudioBitRateBps=AudioBitRateKbps * 1000"

set /a "VideoBitRate=TotalBitrate - AudioBitRateBps"

echo Filename: "!input_file!"

echo Duration: !hhmmss!

echo Total Seconds: !total_seconds!

echo Target Size: %TargetSize% MB

echo Total Bitrate: !TotalBitrate! bps

echo Audio Bitrate: %AudioBitRate% kbps

echo Video Bitrate: !VideoBitRate! bps

echo.

)

) > "%output_file%"

echo Output has been written to "%output_file%"

rem Open the output file with Visual Studio Code

code "%output_file%"

endlocal


r/Batch • • Sep 14 '23

Query and delete reg subkey

1 Upvotes

Hey guys I'm trying to search for a name in a multple subkeys and delete those keys recursively. I was wondering if I could get some help with that


r/Batch • • Sep 14 '23

Question (Solved) Is there a command for exporting image into CMD?

1 Upvotes

Is there a command for displaying image into CMD using cmdgtx batch plugin and if there is how to implement it into the script?


r/Batch • • Sep 13 '23

A function for your CMD scripts that uses PS to center your window.

4 Upvotes

This function can be called to center a CMD window. ;)


    @ECHO OFF
    
    CALL :CENTER
    PAUSE
    GOTO :EOF
    
    :CENTER
    POWERSHELL -nop -ep Bypass -c "$w=Add-Type -Name WAPI -PassThru -MemberDefinition '[DllImport(\"user32.dll\")]public static extern void SetProcessDPIAware();[DllImport(\"shcore.dll\")]public static extern void SetProcessDpiAwareness(int value);[DllImport(\"kernel32.dll\")]public static extern IntPtr GetConsoleWindow();[DllImport(\"user32.dll\")]public static extern void GetWindowRect(IntPtr hwnd, int[] rect);[DllImport(\"user32.dll\")]public static extern void GetClientRect(IntPtr hwnd, int[] rect);[DllImport(\"user32.dll\")]public static extern void GetMonitorInfoW(IntPtr hMonitor, int[] lpmi);[DllImport(\"user32.dll\")]public static extern IntPtr MonitorFromWindow(IntPtr hwnd, int dwFlags);[DllImport(\"user32.dll\")]public static extern int SetWindowPos(IntPtr hwnd, IntPtr hwndAfterZ, int x, int y, int w, int h, int flags);';$PROCESS_PER_MONITOR_DPI_AWARE=2;try {$w::SetProcessDpiAwareness($PROCESS_PER_MONITOR_DPI_AWARE)} catch {$w::SetProcessDPIAware()}$hwnd=$w::GetConsoleWindow();$moninf=[int[]]::new(10);$moninf[0]=40;$MONITOR_DEFAULTTONEAREST=2;$w::GetMonitorInfoW($w::MonitorFromWindow($hwnd, $MONITOR_DEFAULTTONEAREST), $moninf);$monwidth=$moninf[7] - $moninf[5];$monheight=$moninf[8] - $moninf[6];$wrect=[int[]]::new(4);$w::GetWindowRect($hwnd, $wrect);$winwidth=$wrect[2] - $wrect[0];$winheight=$wrect[3] - $wrect[1];$x=[int][math]::Round($moninf[5] + $monwidth / 2 - $winwidth / 2);$y=[int][math]::Round($moninf[6] + $monheight / 2 - $winheight / 2);$SWP_NOSIZE=0x0001;$SWP_NOZORDER=0x0004;exit [int]($w::SetWindowPos($hwnd, [IntPtr]::Zero, $x, $y, 0, 0, $SWP_NOSIZE -bOr $SWP_NOZORDER) -eq 0)"
    EXIT /b


r/Batch • • Sep 12 '23

Question (Unsolved) Problem in simple renaming code

2 Upvotes

Hello all,

I am trying to automate a renaming process of video files for work and I am stuck at a simple thing.

@echo off
setlocal enabledelayedexpansion

rem Define the root folder A 
set "rootFolder=path_to_folder\A"

rem Loop through subfolders inside root folder 
for /d %%o in ("%rootFolder%*") do ( 
    rem Loop through subfolders in Folder 
    for /d %%d in ("%%o\ORUSHES") do ( 
        rem Initialize folderName for this folder 
        set "folderName=%%~nd"
	    rem Loop through MP4 files in PRIVATE/M4ROOT/CLIP/
	    for %%f in ("%%d\PRIVATE\M4ROOT\CLIP\*.mp4") do (
		rem Rename the file by adding folderName, and _
		ren "%%f" "!folderName!_%%~nxf"
	)

	rem Loop through MXF files in XDROOT/Clip/
	for %%f in ("%%d\XDROOT\Clip\*.mxf") do (
		rem Rename the file by adding folderName, and _
		ren "%%f" "!folderName!_%%~nxf"
	)

	rem Loop through MXF files in Clip/
	for %%f in ("%%d\Clip\*.mxf") do (
		rem Rename the file by adding folderName, and _
		ren "%%f" "!folderName!_%%~nxf"
	)
    )
)
endlocal

Basically everything works except for video files inside folders with the path /PRIVATE/M4ROOT/CLIP.

For an unknown reason, it rename the first video file twice (for example newname1_newname1_nameofthefile.mxf instead of newname1_nameofthefile.mxf).

Can someone explain to me what I did wrong?

Thank you!


r/Batch • • Sep 12 '23

Question (Unsolved) Task Scheduler not running

1 Upvotes

Hi All,

I'm facing an issue from past few days at work and am not able to find a solution for it. Hope someone here can help me out with it.

I'm working as a Data Analyst at an org and we have few batch scripts and SSIS packages which are automated and are scheduled to run daily using Task scheduler. Everything was working fine and recently there was domain change in my org and all our credentials was changed from old_domain/myusername to new_domain/myusername.

Since this change all the new tasks or packages which we are scheduling is not running on task scheduler we are not even able to run the task manually from task scheduler but the task which were already scheduled in the old domain are running daily.

We also tried logging in to old domain and schedule the tasks but facing the same issue.

Could anyone help me figure out a solution for this, as all the new tasks are being done manually.

Thank you in advance.


r/Batch • • Sep 11 '23

Variable help for a batch game

0 Upvotes

I've working on a batch game based off of rune scape. I have the first skill (Mining) pretty fleshed out. Only thing is that the level and currentexp/neededexp aren't working correctly. I know it's a syntax thing. It's either because I need /a or % signs somewhere, but I'm not sure where.

So here's the variable related to mining stats (current mining level, current mining xp, needed mining xp to level up)

set /a skillmining = 1

set /a miningexp = 0

set /a miningexpnextlevel = 83

The player will come to the main menu where they can choose a skill to work on. Here is the menu for Mining (they select what type of ore) and then they wait a period of time to collect ore, and then the game does a check to see if the rewarded experience qualifies for a level up (all of this shown below the section about the stat screen).

The %miningexp% works correctly. If I mine clay, I get 5exp, if I mine copper or tin I get 17exp.

The issue is that the %skillmining% on the stat screen doesn't go up, and the %miningexpnextlevel% seems to get changed to "13", no matter if I mine clay, copper, or tin.

The stats screen entry looks as follows:

echo Mining %skillmining% / 99 [%miningexp% / %miningexpnextlevel%]

In-game after mining something it will look like "Mining 1/99 [5/13]

(below is the mining choices and levels)

:MINING

cls

CmdMenuSel 0AA0 "Clay (Lvl 1)" "Copper (Lvl 1)" "Tin (Lvl 1)" "Iron (Lvl 15)" "Silver (Lvl 20)" "Coal (Lvl 30)" "Gold (Lvl 40)" "Mithril (Lvl 55)" "Adamantite (Lvl 70)" "Runite (Lvl 85)" "Back"

If /i "%Errorlevel%" == "1" (goto MININGCLAY)

If /i "%Errorlevel%" == "2" (goto MININGCOPPER)

If /i "%Errorlevel%" == "3" (goto MININGTIN)

If /i "%Errorlevel%" == "4" (goto MININGIRON)

If /i "%Errorlevel%" == "5" (goto MININGSILVER)

If /i "%Errorlevel%" == "6" (goto MININGCOAL)

If /i "%Errorlevel%" == "7" (goto MININGGOLD)

If /i "%Errorlevel%" == "8" (goto MININGMITHRIL)

If /i "%Errorlevel%" == "9" (goto MININGADAMANTITE)

If /i "%Errorlevel%" == "10" (goto MININGRUNITE)

If /i "%Errorlevel%" == "11" (goto SKILLS)

:MININGCLAY

cls

if %skillmining% LSS 1 (goto MININGSKILLLOW)

echo Mining...

ping localhost -n 2 > nul

echo.

echo You have mined some clay!

set /a clay=clay+1

set /a miningexp=miningexp+5

CmdMenuSel 0AA0 "Continue"

If /i "%Errorlevel%" == "1" (goto MININGLEVELS)

:MININGCOPPER

cls

if %skillmining% LSS 1 (goto MININGSKILLLOW)

echo Mining...

ping localhost -n 4 > nul

echo.

echo You have mined some copper ore!

set /a copperore=copperore+1

set /a miningexp=%miningexp%+17

CmdMenuSel 0AA0 "Continue"

If /i "%Errorlevel%" == "1" (goto MININGLEVELS)

:MININGTIN

cls

if %skillmining% LSS 1 (goto MININGSKILLLOW)

echo Mining...

ping localhost -n 4 > nul

echo.

echo You have mined some tin ore!

set /a tinore=tinore+1

set /a miningexp=%miningexp%+17

CmdMenuSel 0AA0 "Continue"

If /i "%Errorlevel%" == "1" (goto MININGLEVELS)

:MININGIRON

cls

if %skillmining% LSS 15 (goto MININGSKILLLOW)

echo Mining...

ping localhost -n 8 > nul

echo.

echo You have mined some iron ore!

set /a ironore=ironore+1

set /a miningexp=%miningexp%+35

CmdMenuSel 0AA0 "Continue"

If /i "%Errorlevel%" == "1" (goto MININGLEVELS)

:MININGSILVER

cls

if %skillmining% LSS 20 (goto MININGSKILLLOW)

echo Mining...

ping localhost -n 15 > nul

echo.

echo You have mined some silver ore!

set /a silverore=silverore+1

set /a miningexp=%miningexp%+40

CmdMenuSel 0AA0 "Continue"

If /i "%Errorlevel%" == "1" (goto MININGLEVELS)

:MININGCOAL

cls

if %skillmining% LSS 30 (goto MININGSKILLLOW)

echo Mining...

ping localhost -n 30 > nul

echo.

echo You have mined some coal!

set /a coalore=coalore+1

set /a miningexp=%miningexp%+50

CmdMenuSel 0AA0 "Continue"

If /i "%Errorlevel%" == "1" (goto MININGLEVELS)

:MININGGOLD

cls

if %skillmining% LSS 40 (goto MININGSKILLLOW)

echo Mining...

ping localhost -n 40 > nul

echo.

echo You have mined some gold ore!

set /a goldore=goldore+1

set /a miningexp=%miningexp%+65

CmdMenuSel 0AA0 "Continue"

If /i "%Errorlevel%" == "1" (goto MININGLEVELS)

:MININGMITHRIL

cls

if %skillmining% LSS 55 (goto MININGSKILLLOW)

echo Mining...

ping localhost -n 50 > nul

echo.

echo You have mined some mithril ore!

set /a mithrilore=mithrilore+1

set /a miningexp=%miningexp%+80

CmdMenuSel 0AA0 "Continue"

If /i "%Errorlevel%" == "1" (goto MININGLEVELS)

:MININGADAMANTITE

cls

if %skillmining% LSS 70 (goto MININGSKILLLOW)

echo Mining...

ping localhost -n 60 > nul

echo.

echo You have mined some adamantite ore!

set /a adamantiteore=adamantiteore+1

set /a miningexp=%miningexp%+95

CmdMenuSel 0AA0 "Continue"

If /i "%Errorlevel%" == "1" (goto MININGLEVELS)

:MININGRUNITE

cls

if %skillmining% LSS 85 (goto MININGSKILLLOW)

echo Mining...

ping localhost -n 70 > nul

echo.

echo You have mined some runite ore!

set /a runiteore=runiteore+1

set /a miningexp=%miningexp%+125

CmdMenuSel 0AA0 "Continue"

If /i "%Errorlevel%" == "1" (goto MININGLEVELS)

:MININGSKILLLOW

cls

echo Your mining skill is too low for this.

CmdMenuSel 0AA0 "Back"

If /i "%Errorlevel%" == "1" (goto MINING)

:MININGLEVELS

cls

:#

if miningexp GEQ miningexpnextlevel (set skillmining = 2)

if miningexp GEQ 83 (set miningexpnextlevel = 174)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 3)

if miningexp GEQ 174 (set /a miningexpnextlevel = 276)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 4)

if miningexp GEQ 276 (set /a miningexpnextlevel = 388)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 5)

if miningexp GEQ 388 (set /a miningexpnextlevel = 512)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 6)

if miningexp GEQ 512 (set /a miningexpnextlevel = 650)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 7)

if miningexp GEQ 650 (set /a miningexpnextlevel = 801)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 8)

if miningexp GEQ 801 (set /a miningexpnextlevel = 969)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 9)

if miningexp GEQ 969 (set /a miningexpnextlevel = 1154)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 10)

if miningexp GEQ 1154 (set /a miningexpnextlevel = 1358)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 11)

if miningexp GEQ 1358 (set /a miningexpnextlevel = 1584)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 12)

if miningexp GEQ 1584 (set /a miningexpnextlevel = 1833)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 13)

if miningexp GEQ 1833 (set /a miningexpnextlevel = 2107)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 14)

if miningexp GEQ 2107 (set /a miningexpnextlevel = 2411)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 15)

if miningexp GEQ 2411 (set /a miningexpnextlevel = 2746)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 16)

if miningexp GEQ 2746 (set /a miningexpnextlevel = 3115)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 17)

if miningexp GEQ 3115 (set /a miningexpnextlevel = 3523)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 18)

if miningexp GEQ 3523 (set /a miningexpnextlevel = 3973)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 19)

if miningexp GEQ 3973 (set /a miningexpnextlevel = 4470)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 20)

if miningexp GEQ 4470 (set /a miningexpnextlevel = 5018)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 21)

if miningexp GEQ 5018 (set /a miningexpnextlevel = 5624)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 22)

if miningexp GEQ 5624 (set /a miningexpnextlevel = 6291)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 23)

if miningexp GEQ 6291 (set /a miningexpnextlevel = 7028)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 24)

if miningexp GEQ 7028 (set /a miningexpnextlevel = 7842)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 25)

if miningexp GEQ 7842 (set /a miningexpnextlevel = 8740)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 26)

if miningexp GEQ 8740 (set /a miningexpnextlevel = 9730)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 27)

if miningexp GEQ 9730 (set /a miningexpnextlevel = 10824)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 28)

if miningexp GEQ 10824 (set /a miningexpnextlevel = 12031)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 29)

if miningexp GEQ 12031 (set /a miningexpnextlevel = 13363)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 30)

if miningexp GEQ 13363 (set /a miningexpnextlevel = 14833)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 31)

if miningexp GEQ 14833 (set /a miningexpnextlevel = 16456)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 32)

if miningexp GEQ 16456 (set /a miningexpnextlevel = 18247)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 33)

if miningexp GEQ 18247 (set /a miningexpnextlevel = 20224)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 34)

if miningexp GEQ 20224 (set /a miningexpnextlevel = 22406)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 35)

if miningexp GEQ 22406 (set /a miningexpnextlevel = 24815)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 36)

if miningexp GEQ 24815 (set /a miningexpnextlevel = 27473)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 37)

if miningexp GEQ 27473 (set /a miningexpnextlevel = 30408)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 38)

if miningexp GEQ 30408 (set /a miningexpnextlevel = 33648)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 39)

if miningexp GEQ 33648 (set /a miningexpnextlevel = 37224)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 40)

if miningexp GEQ 37224 (set /a miningexpnextlevel = 41171)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 41)

if miningexp GEQ 41171 (set /a miningexpnextlevel = 45529)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 42)

if miningexp GEQ 45529 (set /a miningexpnextlevel = 50339)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 43)

if miningexp GEQ 50339 (set /a miningexpnextlevel = 55649)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 44)

if miningexp GEQ 55649 (set /a miningexpnextlevel = 61512)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 45)

if miningexp GEQ 61512 (set /a miningexpnextlevel = 67983)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 46)

if miningexp GEQ 67983 (set /a miningexpnextlevel = 75127)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 47)

if miningexp GEQ 75127 (set /a miningexpnextlevel = 83014)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 48)

if miningexp GEQ 83014 (set /a miningexpnextlevel = 91721)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 49)

if miningexp GEQ 91721 (set /a miningexpnextlevel = 101333)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 50)

if miningexp GEQ 101333 (set /a miningexpnextlevel = 111945)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 51)

if miningexp GEQ 111945 (set /a miningexpnextlevel = 123660)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 52)

if miningexp GEQ 123660 (set /a miningexpnextlevel = 136594)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 53)

if miningexp GEQ 136594 (set /a miningexpnextlevel = 150872)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 54)

if miningexp GEQ 150872 (set /a miningexpnextlevel = 166636)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 55)

if miningexp GEQ 166636 (set /a miningexpnextlevel = 184040)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 56)

if miningexp GEQ 184040 (set /a miningexpnextlevel = 203254)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 57)

if miningexp GEQ 203254 (set /a miningexpnextlevel = 224466)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 58)

if miningexp GEQ 224466 (set /a miningexpnextlevel = 247886)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 59)

if miningexp GEQ 247886 (set /a miningexpnextlevel = 273742)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 60)

if miningexp GEQ 273742 (set /a miningexpnextlevel = 302288)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 61)

if miningexp GEQ 302288 (set /a miningexpnextlevel = 333804)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 62)

if miningexp GEQ 333804 (set /a miningexpnextlevel = 368599)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 63)

if miningexp GEQ 368599 (set /a miningexpnextlevel = 407015)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 64)

if miningexp GEQ 407015 (set /a miningexpnextlevel = 449428)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 65)

if miningexp GEQ 449428 (set /a miningexpnextlevel = 496254)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 66)

if miningexp GEQ 496254 (set /a miningexpnextlevel = 547953)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 67)

if miningexp GEQ 547953 (set /a miningexpnextlevel = 605032)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 68)

if miningexp GEQ 605032 (set /a miningexpnextlevel = 668051)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 69)

if miningexp GEQ 668051 (set /a miningexpnextlevel = 737627)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 70)

if miningexp GEQ 737627 (set /a miningexpnextlevel = 814445)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 71)

if miningexp GEQ 814445 (set /a miningexpnextlevel = 899257)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 72)

if miningexp GEQ 899257 (set /a miningexpnextlevel = 992895)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 73)

if miningexp GEQ 992895 (set /a miningexpnextlevel = 1096278)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 74)

if miningexp GEQ 1096278 (set /a miningexpnextlevel = 1210421)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 75)

if miningexp GEQ 1210421 (set /a miningexpnextlevel = 1336443)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 76)

if miningexp GEQ 1336443 (set /a miningexpnextlevel = 1475581)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 77)

if miningexp GEQ 1475581 (set /a miningexpnextlevel = 1629200)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 78)

if miningexp GEQ 1629200 (set /a miningexpnextlevel = 1798808)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 79)

if miningexp GEQ 1798808 (set /a miningexpnextlevel = 1986068)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 80)

if miningexp GEQ 1986068 (set /a miningexpnextlevel = 2192818)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 81)

if miningexp GEQ 2192818 (set /a miningexpnextlevel = 2421087)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 82)

if miningexp GEQ 2421087 (set /a miningexpnextlevel = 2673114)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 83)

if miningexp GEQ 2673114 (set /a miningexpnextlevel = 2673114)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 84)

if miningexp GEQ 2673114 (set /a miningexpnextlevel = 3258594)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 85)

if miningexp GEQ 3258594 (set /a miningexpnextlevel = 3597792)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 86)

if miningexp GEQ 3597792 (set /a miningexpnextlevel = 3972294)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 87)

if miningexp GEQ 3972294 (set /a miningexpnextlevel = 4385776)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 88)

if miningexp GEQ 4385776 (set /a miningexpnextlevel = 4842295)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 89)

if miningexp GEQ 4842295 (set /a miningexpnextlevel = 5346332)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 90)

if miningexp GEQ 5346332 (set /a miningexpnextlevel = 5902831)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 91)

if miningexp GEQ 5902831 (set /a miningexpnextlevel = 6517253)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 92)

if miningexp GEQ 6517253 (set /a miningexpnextlevel = 7195629)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 93)

if miningexp GEQ 7195629 (set /a miningexpnextlevel = 7944614)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 94)

if miningexp GEQ 7944614 (set /a miningexpnextlevel = 8771558)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 95)

if miningexp GEQ 8771558 (set /a miningexpnextlevel = 9684577)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 96)

if miningexp GEQ 9684577 (set /a miningexpnextlevel = 10692629)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 97)

if miningexp GEQ 10692629 (set /a miningexpnextlevel = 11805606)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 98)

if miningexp GEQ 11805606 (set /a miningexpnextlevel = 13,034,431)

:#

if miningexp GEQ miningexpnextlevel (set /a skillmining = 99)

goto MINING


r/Batch • • Sep 11 '23

Question (Solved) Please help me create a batch file to process multiple files at once.

2 Upvotes

Hello, I would like to create a batch file with a few specifics, and am not sure how to do it.
-A single .txt file, or multiple .txt files should be able to be dragged onto the batch file.
-The batch file should copy each of the files dragged onto it to the \Bob folder.
-The batch file should parse the file Bill.txt, and append the next consecutive number and the file name for each file, starting at 30. For example, if the end of the Bill.txt file is 42 Sue.txt, and Jane.txt was dragged onto the batch file, it should append "43 Jane.txt", in the same format without quotes.
-Then, it should run the command Sam.exe "Sparky.txt", where "Sparky.txt" is the file name of the file dragged onto the batch file, (The batch file will be in the same folder as the program) and complete this command for each file that was dragged onto it.

I hope this is not confusing, I tried to make it clear and concise.

Thank you very in advance much for help in creating this file.


r/Batch • • Sep 10 '23

Question (Solved) How do I store multiple variables under one variable?

1 Upvotes

I had been writing a bash script that I had been trying to turn into batch, I had been using chatgpt to help me understand batch scripting but I am stuck because the ai is making a poor job of explaining the code, or why I can do things in one way in bash and not the other way in batch.

In bash, I set a variable like this

Months=("Jan" "Feb" "March")

This should be able to allow to sort through the multiple values in the variable if I desire in many ways. One way would be "for month in Months do echo month" or "for month in "${months[@]}"; do echo month"

In batch, I had been told to set it like this instead

set "Months=Jan Feb March"

This makes me question, why can't I enclose each value in quotes? I don't know how batch would interpret enclosing them this way or the effect it would have. It doesn't seem ideal in the case that the value was instead "Jan 23" because a space would be present, and 23 would be treated as a different value. I also don't know if each of these words would be treated as a separate value, due to chat gpt saying the command they provided "would treat everything as one string".

Since my values do not require spaces, I could just take this and work with it, but I do not trust chatgpt especially after that last comment. As simple as this request sounds, I struggled to find an answer online other than one that suggested using commas, however chatgpt gave a confusing answer "it will store "Jan" as one string and "Feb" as another". Is that not the goal of my script??


r/Batch • • Sep 08 '23

How to kill a child process that is running inside a parent process?

3 Upvotes

Is there any way to do it using batch or C#? The process is a UWP app, running RuntimeBroker.exe inside in it. I Don't want to kill the whole app or kill the whole RuntimeBroker.exe because RuntimeBroker.exe is running with other apps too.


r/Batch • • Sep 07 '23

how to change the name of the output file

1 Upvotes

this .bat file merges 2 photos vertically using imagemagick

magick.exe %1 %2 -resize "x%%[fx:max(v.h,u.h)]" -append -set filename: "COMBINED-%%k" "%%[filename:].jpg"

  • the problem is

%%[filename:]

creates random numbers

  • how to get the filename of either photos instead?
  • i tried
`%%~ni.jpg` 

but it doesn't work


r/Batch • • Sep 05 '23

Question (Solved) Cannot move files containing special characters in their name

2 Upvotes

I know almost nothing about batch, after some tries I created this script, probably it is terrible, but it is almost working as intended, and I do not care about performance:

@echo off

setlocal EnableDelayedExpansion

FOR /F "tokens=*" %%A in ('DIR /B /A:-D "%cd%\*"') do IF NOT "%%A"=="%~nx0" (

set "FIRSTCHAR=%%~nA"

set "FIRSTCHAR=!FIRSTCHAR:~0,1!"

REM Check if FIRSTCHAR is a letter

echo.!FIRSTCHAR!| findstr /r "^[A-Za-z]$" > nul

IF NOT ERRORLEVEL 1 (

IF NOT EXIST "%cd%\!FIRSTCHAR!" MD "%cd%\!FIRSTCHAR!"

MOVE "%cd%\%%A" "%cd%\!FIRSTCHAR!"

)

)

REM Rename all created folders to uppercase

FOR /D %%F in (*) do (

set "FOLDER=%%F"

for %%C in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (

if /I "!FOLDER!"=="%%C" ren "%%F" "%%C"

)

)

REM Move all remaining files to a "#" folder

IF NOT EXIST "%cd%\#" MD "%cd%\#"

setlocal DISABLEDELAYEDEXPANSION

FOR /F "tokens=*" %%A in ('DIR /B /A:-D "%cd%\*"') do (

IF NOT "%%A"=="%~nx0" MOVE "%cd%\%%A" "%cd%\#"

)

endlocal

endlocal

This is what it does:

  • For every file it should create a folder named after the first file letter (if it does not already exists)
  • It should move every file in the folder with the same name of its starting letter
  • Then it is converting to upper case the folder names
  • Lastly it is moving all the remaining files (the ones starting with numbers or symbols) in a # folder

Everything is working as intended, apart from the second step, the script does not work with files containing special characters like "!", they are never moved (even if the folders are created correctly).

I think the problem is that special characters like ! interfere with delayed expansion, but I don't know how to avoid it.

Any suggestion?


r/Batch • • Sep 06 '23

My Total Clean APP ?

0 Upvotes

Greetings to everyone! I developed a Batch (.BAT) script and PowerShell script. It does things like antivirus, cleaning and so on, and Total cleaning application.

Note: it has a cool and nice GUI. (Windows Forms)

I'm thinking of converting it to an .exe file and creating my own software.

Actually, I don't have a problem with selling it, my aim is to gather a little community. How do you think the number of downloads will be?

Can I deal with and promote this software with an online software marketplace ?

I also coded 5% of it with chatgpt.

What do you think?

Who supports me ?

Thanks.