• THE TH PROJECT
  • BATCH
  • C
  • C#
  • Fortran
  • Javascript
  • Natural
  • SQL User Defined Function
  • Visual Basic Script
  • Visual Basic .NET
  • CONTACT
© 2025 CCVIII

Batch

Instructions: Copy everything in between the "Start of Code" and "End of Code" tags and paste it into notepad. Save as th.bat. Then just call th.bat from any other batch file.

Sample BATCH call

@echo off
...some code
Call th.bat 1
echo 1%ending%
set ending=

Sample Results

1ST

Start of Code
@echo off
REM Prototyped by: John Naudus
set ending=

if "%1" == "" goto Help
if "%1" == "/?" goto Help
if "%1" == "?" goto Help
if %1 == 0 goto end

for %%z in (1 2 3 4 5 6 7 8 9) do for %%d in (
1 21 31 41 51 61 71 81 91
%%z01 %%z21 %%z31 %%z41 %%z51 %%z61 %%z71 %%z81 %%z91
) do (
if %1 == %%d goto st
)
for %%y in (1 2 3 4 5 6 7 8 9) do for %%e in (
2 22 32 42 52 62 72 82 92
%%y02 %%y22 %%y32 %%y42 %%y52 %%y62 %%y72 %%y82 %%y92
) do (
if %1 == %%e goto nd
)
for %%x in (1 2 3 4 5 6 7 8 9) do for %%f in (
3 23 33 43 53 63 73 83 93
%%x03 %%x23 %%x33 %%x43 %%x53 %%x63 %%x73 %%x83 %%x93
) do (
if %1 == %%f goto rd
)
for %%z in (1 2 3 4 5 6 7 8 9) do for %%y in (
1 2 3 4 5 6 7 8 9 0
) do for %%d in (
4 5 6 7 8 9 11 12 13 0
%%z4 %%z5 %%z6 %%z7 %%z8 %%z9 %%z11 %%z12 %%z13 %%z0
%%z%%y4 %%z%%y5 %%z%%y6 %%z%%y7 %%z%%y8 %%z%%y9 %%z%%y11 %%z%%y12 %%z%%y13
%%z%%y0
) do (
if %1 == %%d goto th
)

goto Help

:th
set ending=TH
goto end
:st
set ending=ST
goto end
:nd
set ending=ND
goto end
:rd
set ending=RD
goto end
:Help
echo TH (Number)
:end
End of Code