Search found 7 matches
- 16 May 2018 11:28
- Forum: DOS Batch Forum
- Topic: Random number generation problem
- Replies: 2
- Views: 3185
Random number generation problem
Hello, I wrote a script that would call a random batch file out of 154 files in total. I wanted to have some files to have a higher chance of being called than others, so I wrote this: :randomization cls set /a randoma=%random% %% 10+1 if %randoma%==1 goto random1 if %randoma%==2 goto random1 if %ra...
- 08 Mar 2018 02:43
- Forum: DOS Batch Forum
- Topic: spaces in an if statement
- Replies: 2
- Views: 3001
Re: spaces in an if statement
It works, thank you!
- 07 Mar 2018 23:51
- Forum: DOS Batch Forum
- Topic: spaces in an if statement
- Replies: 2
- Views: 3001
spaces in an if statement
I am currently writing a script which asks you to type in multiple words and then checks if they were correct. I know you can put them in "" , but if you do it like this: @echo off :loop echo Type "hello world". set /p input= if %input%=="hello world" goto helloworld echo Error. pause >nul goto loop...
- 28 Feb 2018 10:25
- Forum: DOS Batch Forum
- Topic: Using the for /f command
- Replies: 1
- Views: 2617
Using the for /f command
So, I was wondering if it was possible to use the for /f command to insert commands written in a text file into a batch script, for example: This is saved as hello.txt: echo hello This is saved as hello.bat @echo off for /f "tokens=* delims= " %%a in (hello.txt) do ( %%a ) pause This works, but if i...
- 27 Feb 2018 15:00
- Forum: DOS Batch Forum
- Topic: Counter with batch
- Replies: 5
- Views: 5874
Re: Counter with batch
Thank you, now I understand it
- 26 Feb 2018 11:03
- Forum: DOS Batch Forum
- Topic: Counter with batch
- Replies: 5
- Views: 5874
Re: Counter with batch
Okay, I noticed I made a pretty stupid mistake. Of course, every time it goes to loop, it resets the counter to zero. Got it now
- 26 Feb 2018 07:51
- Forum: DOS Batch Forum
- Topic: Counter with batch
- Replies: 5
- Views: 5874
Counter with batch
Hello, I'm new to batch and I'm just learning how to do simple things. I wanted to make a simple counter, so tht every time you type in a certain word or number, it would add 1 to the counter. I typed this into the Editor: @echo off setlocal enabledelayedexpansion :loop echo test set a COUNTER=0 set...