Batch number system
Moderator: DosItHelp
Batch number system
I have a code where
if %num%==1 echo %pre determined value%
And so on untill 99 is there a way to make it so when thefb user types a number in between 201 and 299 it will echo cc%pre determined value% of the existing number for example user types 201 output is cc%value of one %
if %num%==1 echo %pre determined value%
And so on untill 99 is there a way to make it so when thefb user types a number in between 201 and 299 it will echo cc%pre determined value% of the existing number for example user types 201 output is cc%value of one %
Re: Batch number system
Can you use more English words to describe what you want to do, and add some examples?
I can't follow what the task is.
I can't follow what the task is.
Re: Batch number system
I have a list of numeric values 1. - 200 and I want to set values for the values 201 - 299 the values mus be the same as the values 1 - 99 but with the letters cc infront of every value for example if the value for number 1 is a the the value for 201 would be cca but rather than type that for every value how can I just do it automatcly?
Re: Batch number system
Ok. Where do you have the list of values for 1 to 200? In a file?
Re: Batch number system
Yes my first file r.bat calls num.bat which contains the values
Re: Batch number system
The way a batch file provides the numbers depends on how you are using the 1 to 200 numbers.
Are they in an array, or are you searching with findstr? The details will determine how to help you.
Are they in an array, or are you searching with findstr? The details will determine how to help you.
Re: Batch number system
R.bat
:top
set/p num=
Call num.bat
Num.bat
if %num%==1 echo a
If %num%==2 echo b
Code continues until 200 then goes to :top
:top
set/p num=
Call num.bat
Num.bat
if %num%==1 echo a
If %num%==2 echo b
Code continues until 200 then goes to :top
Re: Batch number system
is there a way to do this this way
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Batch number system
You could just delete 200 from %num% if %num% is greater than 200 before you did all the other comparisons in num.bat
Code: Select all
if %num% gtr 200 (
set /a num=%num%-200
)
Re: Batch number system
Thanks shadow their but is there a way to use lss as well so if the value is grater that 299 the file uses
if %num% gtr 300 (
set /a num=%num%-300
)
Could this be added after to make the file deal with numbers over 300? Thanks
if %num% gtr 300 (
set /a num=%num%-300
)
Could this be added after to make the file deal with numbers over 300? Thanks
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Batch number system
I would recommend adding it before the
line just so that both are used correctly, but sure.
Code: Select all
if %num% gtr% 200
line just so that both are used correctly, but sure.
Re: Batch number system
Ok thanks so much
Re: Batch number system
using
if %num% gtr 1000 (
type 1000.txt & set /a num=%num%-1000
)
if %num% gtr 900 (
type 900.txt & set /a num=%num%-900
)
if %num% gtr 800 (
type 800.txt & set /a num=%num%-800
)
if %num% gtr 700 (
type 700.txt & set /a num=%num%-700
)
if %num% gtr 600 (
type 600.txt & set /a num=%num%-600
)
if %num% gtr 500 (
type 500.txt & set /a num=%num%-500
)
if %num% == 400 echo CD
if %num% gtr 400 (
type 400.txt & set /a num=%num%-400
)
if %num% gtr 300 (
type 300.txt & set /a num=%num%-300
)
if %num% gtr 200 (
type 200.txt & set /a num=%num%-200
)
in num.bat and 400.txt the input for 400 is wrong it says CCCC rather than CD which is the only text in 400.txt
is there a way to fix this
if %num% gtr 1000 (
type 1000.txt & set /a num=%num%-1000
)
if %num% gtr 900 (
type 900.txt & set /a num=%num%-900
)
if %num% gtr 800 (
type 800.txt & set /a num=%num%-800
)
if %num% gtr 700 (
type 700.txt & set /a num=%num%-700
)
if %num% gtr 600 (
type 600.txt & set /a num=%num%-600
)
if %num% gtr 500 (
type 500.txt & set /a num=%num%-500
)
if %num% == 400 echo CD
if %num% gtr 400 (
type 400.txt & set /a num=%num%-400
)
if %num% gtr 300 (
type 300.txt & set /a num=%num%-300
)
if %num% gtr 200 (
type 200.txt & set /a num=%num%-200
)
in num.bat and 400.txt the input for 400 is wrong it says CCCC rather than CD which is the only text in 400.txt
is there a way to fix this
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Batch number system
Wait, are you writing a batch script to convert Arabic numerals to Roman numerals? That would have been really good to know from the beginning.
Re: Batch number system
No shadowtheif this has nothing to do with arabic however it does use roman numerals in this part of the code but roman numerals stop after the of the same letter III CCC LLL MMM but for the number 400 the code prints CCCC rather than cd is this because cd is a cmd command? It also doesn't work with 500 900 and 1000 but digits above that work for example 501 is displayed correctly even though 500 is incorrect.