Batch Random Charachters Err - batch-file

I was playing around with batch scripts on windows and I was trying to make a basic password generator.
( Maximum setlocal recursion level reached. )
My code :
#Echo Off
color 0a
set /P lengthnumberuser="What length do you want your password to be? "
pause
cls
:code
Setlocal EnableDelayedExpansion
set _RNDLength=16
set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
set _Str=%_Alphanumeric%987654321
:_LenLoop
if NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%& SET /A _Len+=9& GOTO :_LenLoop
set _tmp=%_Str:~9,1%
set /A _Len=_Len+_tmp
set _count=0
sET _RndAlphaNum=
:_loop
set /a _count+=1
sET _RND=%Random%
set /A _RND=_RND%%%_Len%
sET _RndAlphaNum=!_RndAlphaNum!!_Alphanumeric:~%_RND%,1!
if !_count! lss %_RNDLength% goto _loop
echo !_RndAlphaNum!
goto code
pause

Just delete the goto code at the end of the your code.
See Here : Link

Related

Echoing a Space Character Into a File

I want to make a batch obfuscator with no outside tools, but I have a problem with echoing the spaces into the 'obfuscated' code('obfuscated' as in separating the code letter by letter between hundreds of random characters). I have found batch obfuscators that are used with CertUtil, but they can be de-obfuscated with another file, so I really want to get this working, and I haven't really found any unique ones.
When I run my file with the input file (contains #echo off and echo test), I get the obfuscated code:
$zz$j?$z?$#z#?$z?$z###$j?j#zz?$?##j$?$?$#z$$#zjj#zzz?j#jzj#zjjzj?$#$jj?j##z##?#$$$#zjz?$zj#j$zz#jzj###$z#j#j#??##zj#z#j$?$jzjz?$j?$?##zzz#???z$$jzj#??###jz$?$j$z$?$?$?j$j?$jzzj#j#z$zz$jzz#z#$jz#?z?$$$?e$?$j?$##?#zjjjjz#j$$zjjz##$?jzjj?$##?##j$#z#zj?zzjzj$$j#$j$????$z#j#$?j?#j$$$$#jzj$$j#z#z###?j#zjz#jc$#jjz$j#$zj?#z$$?j$z$#?zz$$zz#z?##j#zz#j#z##?$#z$j?$j?z$#?#$$z??j?zj#j$##?#$zz#$$$z?z$z?jz#?j?j#z$?jhj??z?zzj##$?#j$$j#j?#$?$j$$zzzzjjz?z?##$?$$j$zz#?j#?##z#jz$z#jz$z?zzj$###z#jzjzz$##?$j??$??#?zz##?$$ojj#$j$j##?#?jzj$z#?zz##$jjjj#j#?$##j?$?j$#jzzj#?$?jz#$#z#$j???z#$?z?jzzzj$?#jzj#j$#j#??j$?jj?jzz?$#$##z$jjj#?jjz#??jz$?###$j$##$$#$$#?$?j$?z$j?j##?z$#jj?#jzjjjzz$jzjj$##z$?#$##z#$#z##$z?zz##$z?jj$#??jo#$##jjjj?$z$?#z?$##zjz$#j#zz#z?$#$##$j#j?#$#$zz$zj#j?$jjz#jjzjjz#$$j#jjz$?z?j?j#?j$#?zj?jjzzz#$?$##jfzj#?##?jjzjjz$??#zjj??j#????#z#$$$?$?##z$#$zj?jj?#?z$jzj?$j?#??zzj#$jj$?z#j???jjj#$jj$###?$$##jjz?$jf$$##z$$?jjj$##z$$jz#z#z?#j##$?$$##z?z$z$$$#jj$?zj?#jz#z$jz?$#j$?#j##z$$jz?$z$$?z#?jz?$$zz$$$#$$?#jjjjz?zj?$$j?#$#?jjj?$$?j$$$#??j?zzz#?zjz$jjzz$?zjz##j#$?z#z$??$?$?jj?###jj##$zjjj$z$?###z#z$??z#jz#zjz?$?j#j$j#zj??j#z??z$$z#$$$$##z$?#?$$jjjj#zz#j###?j??z#$#$$?j##z#$#$$z#jjzj#$#jjjz?###$???zzzz$#$z?j$$$#??z?#j$j$???z?$jz$z?z???z?j#j??$z$$#$#$#j??$$##zjj#j#$$z$$?jj?jzjzjz$$z#zz?$?j$zjzjzz$j#j$#??j???jjj##z#$$$#j$#?j?#z$#$?#zj#?$$??jj?#z#?$##jzzz?$$$zjjjzzjz#$#?#$#jz$z?$z##jjjzj?z?j???j??##$zj$zj?#zjzj##j#z$$???#$jzj#z?z??jj##??z####?#?#z??j$????$$zz#jzj?z?j?z?#z$zz??j$?zz#jj##zz##??zj?#z??$?j###?zz#zjjzj$$z#??#?$?#$jj#j?$$$j?zzjz?$?#z#z$#jj#jz$???zj$jjjz$jz#j#$zz?jj#jj?#jj###?z#$j?zzj#jz?$#zj?#?j#?z??$z??jzz?#zj??j?$z##z#j$zjz#zz?$zj$?jjz?jjj$?j$$#z#?#j?zj$$j#jj#z?z#j#?jzzz$jjj$jzjz$j#j#j#?zzzz??z#z$jz#$#z$$?jz$j#?jz??jj#jj$z#z##j$j$##$???z??j?zzjz$??j#zzz#$jj#jzj#z$z$$?$z$jzzj#$#z$#z?z$###???$$?zz$#??j$?$j#j$#?zj$jzzj??j?z?zzz##?j$?z?j$jjz$jj?z#?j##$$?zjzjj#jjj??z$?#zzj$j#??z#zz$$j?jzj#j
$zz$j?$z?$#z#?$z?$z###$j?j#zz?$?##j$?$?$#z$$#zjj#zzz?j#jzj#zjjzj?$#$jj?j##z##?#$$$#zjz?$zj#j$zz#jzj#e#$z#j#j#??##zj#z#j$?$jzjz?$j?$?##zzz#???z$$jzj#??###jz$?$j$z$?$?$?j$j?$jzzj#j#z$zz$jzz#z#$jz#?z?$$$?c$?$j?$##?#zjjjjz#j$$zjjz##$?jzjj?$##?##j$#z#zj?zzjzj$$j#$j$????$z#j#$?j?#j$$$$#jzj$$j#z#z###?j#zjz#jh$#jjz$j#$zj?#z$$?j$z$#?zz$$zz#z?##j#zz#j#z##?$#z$j?$j?z$#?#$$z??j?zj#j$##?#$zz#$$$z?z$z?jz#?j?j#z$?joj??z?zzj##$?#j$$j#j?#$?$j$$zzzzjjz?z?##$?$$j$zz#?j#?##z#jz$z#jz$z?zzj$###z#jzjzz$##?$j??$??#?zz##?$$jj#$j$j##?#?jzj$z#?zz##$jjjj#j#?$##j?$?j$#jzzj#?$?jz#$#z#$j???z#$?z?jzzzj$?#jzj#j$#j#??j$?jj?jzz?$#$h##z$jjj#?jjz#??jz$?###$j$##$$#$$#?$?j$?z$j?j##?z$#jj?#jzjjjzz$jzjj$##z$?#$##z#$#z##$z?zz##$z?jj$#??ji#$##jjjj?$z$?#z?$##zjz$#j#zz#z?$#$##$j#j?#$#$zz$zj#j?$jjz#jjzjjz#$$j#jjz$?z?j?j#?j$#?zj?jjzzz#$?$##jzj#?##?jjzjjz$??#zjj??j#????#z#$$$?$?##z$#$zj?jj?#?z$jzj?$j?#??zzj#$jj$?z#j???jjj#$jj$###?$$##jjz?$j$$##z$$?jjj$##z$$jz#z#z?#j##$?$$##z?z$z$$$#jj$?zj?#jz#z$jz?$#j$?#j##z$$jz?$z$$?z#?jz?$$zz$$$#$$?#jjjjz?zj?$$j?#$#?jjj?$$?j$$$#??j?zzz#?zjz$jjzz$?zjz##j#$?z#z$??$?$?jj?###jj##$zjjj$z$?###z#z$??z#jz#zjz?$?j#j$j#zj??j#z??z$$z#$$$$##z$?#?$$jjjj#zz#j###?j??z#$#$$?j##z#$#$$z#jjzj#$#jjjz?###$???zzzz$#$z?j$$$#??z?#j$j$???z?$jz$z?z???z?j#j??$z$$#$#$#j??$$##zjj#j#$$z$$?jj?jzjzjz$$z#zz?$?j$zjzjzz$j#j$#??j???jjj##z#$$$#j$#?j?#z$#$?#zj#?$$??jj?#z#?$##jzzz?$$$zjjjzzjz#$#?#$#jz$z?$z##jjjzj?z?j???j??##$zj$zj?#zjzj##j#z$$???#$jzj#z?z??jj##??z####?#?#z??j$????$$zz#jzj?z?j?z?#z$zz??j$?zz#jj##zz##??zj?#z??$?j###?zz#zjjzj$$z#??#?$?#$jj#j?$$$j?zzjz?$?#z#z$#jj#jz$???zj$jjjz$jz#j#$zz?jj#jj?#jj###?z#$j?zzj#jz?$#zj?#?j#?z??$z??jzz?#zj??j?$z##z#j$zjz#zz?$zj$?jjz?jjj$?j$$#z#?#j?zj$$j#jj#z?z#j#?jzzz$jjj$jzjz$j#j#j#?zzzz??z#z$jz#$#z$$?jz$j#?jz??jj#jj$z#z##j$j$##$???z??j?zzjz$??j#zzz#$jj#jzj#z$z$$?$z$jzzj#$#z$#z?z$###???$$?zz$#??j$?$j#j$#?zj$jzzj??j?z?zzz##?j$?z?j$jjz$jj?z#?j##$$?zjzjj#jjj??z$?#zzj$j#??z#zz$$j?jzj#j
However, when I manually remove all of the characters, I am left with:
#echooff
echotest
Is there a way to echo spaces into a file by itself so this problem will be fixed?
My code:
#echo off
set /a N=0
:file
set /p "file=Enter filename: "
if not exist %file% echo Please try again. The file you specified does not exist.
if not exist %file% pause>nul
if not exist %file% cls
if not exist %file% goto file
cls
echo Please wait.
set /a overallfirst=1
set /a double=0
for /F "usebackq tokens=*" %%f in ("%file%") do goto start
:start
set /a "tamp=%random%"
set /a loop2=0
set /a rand=%random% %%5 +1
if %rand%==1 echo #> %tamp%
if %rand%==2 echo $> %tamp%
if %rand%==3 echo ?> %tamp%
if %rand%==4 echo z> %tamp%
if %rand%==5 echo j> %tamp%
:chars
if %loop2%==100 goto next
set /a rand=%random% %%5 +1
if %rand%==1 <nul set /p=#>> %tamp%
if %rand%==2 <nul set /p=$>> %tamp%
if %rand%==3 <nul set /p=?>> %tamp%
if %rand%==4 <nul set /p=z>> %tamp%
if %rand%==5 <nul set /p=j>> %tamp%
set /a loop2+=1
goto chars
:next
for /f "usebackq tokens=*" %%f in ("%tamp%") do set chars=%%f
set "start=^<nul set /p=%chars%^>^> Obfuscated.bat"
del %tamp%
set /a loop=-1
set /a first=1
for %%i in (%file%) do #set count=%%~zi
echo #echo off> Chars.bat
if %double%==0 echo empty^> Obfuscated.bat>> Chars.bat
echo for /f "tokens=*" %%%%a in (%file%) do set id=%%%%a ^& call :processline %%%%a >> Chars.bat
echo cls>>Chars.bat
echo echo Obfuscated code:>>Chars.bat
echo echo -------------------------->>Chars.bat
echo type Obfuscated.bat>>Chars.bat
echo pause^>nul>>Chars.bat
echo exit >> Chars.bat
echo goto :eof >> Chars.bat
echo :processline >> Chars.bat
:loop
set /a loop=%loop%+1
if %loop%==%count% goto end
if %first%==1 set first=0 & goto other
set "command=^<nul set /p=%%id:~%loop%,1%%"
echo %command%^>^> Obfuscated.bat>> Chars.bat
goto next1
:other
set "command=%start%"
echo %command%>> Chars.bat
set /a loop=%loop%-1
goto loop
:next1
set /a "tamp=%random%"
set /a loop2=0
set /a rand=%random% %%5 +1
if %rand%==1 echo #> %tamp%
if %rand%==2 echo $> %tamp%
if %rand%==3 echo ?> %tamp%
if %rand%==4 echo z> %tamp%
if %rand%==5 echo j> %tamp%
:chars
if %loop2%==100 goto next2
set /a rand=%random% %%5 +1
if %rand%==1 <nul set /p=#>> %tamp%
if %rand%==2 <nul set /p=$>> %tamp%
if %rand%==3 <nul set /p=?>> %tamp%
if %rand%==4 <nul set /p=z>> %tamp%
if %rand%==5 <nul set /p=j>> %tamp%
set /a loop2+=1
goto chars
:next2
for /f "usebackq tokens=*" %%f in ("%tamp%") do set chars=%%f
set "command=^<nul set /p=%chars%"
echo %command%^>^> Obfuscated.bat>> Chars.bat
del %tamp%
goto loop
:end
echo echo. ^>^> Obfuscated.bat>> Chars.bat
echo goto :eof >> Chars.bat
echo :eof >> Chars.bat
start Chars.bat
if %overallfirst%==1 set /a overallfirst=0 & set /a double=1
I have looked for a solution, but I was unable to find one.
(I am fairly new to Batch coding so this script is not very efficient)
Try using <nul set /p and echo/. This post may help: Preserve spaces with <Nul set /p

Why does my batch file generated text not format properly?

The Problem:
I'm trying to create a batch file which randomly generates passwords, but I cannot seem to get the generated passwords to format properly.
Before, I just chose to generate numbers, but I realized that it wasn't very secure for users, and I needed to include letters and numbers. I attempted, but it output the wrong thing (kind of).
I want the generated passwords to be at least 8 characters long, and 32 characters maximum. I tried it, but it completely broke the code and it wouldn't output anything at all. Also, it outputs the same passwords for each one on every option. For example, if I chose option 1 (generate 2 passwords), it would output ud8aqas and ud8aqas. If I chose option 2 (generate 5 passwords), it would output p9dkda, p9dkda, p9dkda, p9dkda, and p9dkda, and so on.
The code that I want to use:
#echo off
:Start2
cls
goto Start
:Start
title DotPass Password Generator [BETA]
echo Thanks for using DotPass! If you have any questions, feel free to email us at mhartmix#gmail.com.
echo Please maximise this program so you can see all of the details we have shown!
echo ------------------------------------------------------------------------------------------------------
echo DotPass will generate you a new PIN (or password, if that's what you're going to use it for).
echo You can use these for any of your online accounts! Remember to always note the PIN/password down somewhere!
echo -------------------------------------------------------------------------------------------------------
echo Note: The passwords/PIN's can only be seen by you, not us. To read more, go to github.com/TechGeekMic/DotPass/blob/Main/security.md
echo Passwords generated are never stored on the cloud, or locally, so that's why you should make a note of your randomly generated PIN/password.
echo -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
echo How many passwords do you want DotPass to generate?
echo 1) 2 Generated Random Password
echo 2) 5 Generated Random Passwords
echo 3) 10 Generated Random Passwords
echo Type the number of your choice below. ( i.e 2 )
set input=
set /p input= Choice:
if %input%==1 goto A if NOT goto Start2
if %input%==2 goto B if NOT goto Start2
if %input%==3 goto C if NOT goto Start2
:A
cls
Setlocal EnableDelayedExpansion
Set _RNDLength=12
Set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Set _Str=%_Alphanumeric%987654321
:_LenLoop
IF NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%& SET /A _Len+=9& GOTO :_LenLoop
SET _tmp=%_Str:~9,1%
SET /A _Len=_Len+_tmp
Set _count=0
SET _RndAlphaNum=
:_loop
Set /a _count+=1
SET _RND=%Random%
Set /A _RND=_RND%%%_Len%
SET _RndAlphaNum=!_RndAlphaNum!!_Alphanumeric:~%_RND%,1!
If !_count! lss %_RNDLength% goto _loop
echo Your two randomly generated passwords are !_RndAlphaNum! and !_RndAlphaNum!
)
echo What do you want do to? Here are a few options.
echo 1) Go back to the beginning
echo 2) Exit DotPass
echo 3) Shutdown your computer
echo Type the number of your choice below. ( i.e 1 )
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2
if %input%==3 goto Shutdown if NOT goto Start 2
:Shutdown
shutdown
:Exit
exit
:B
cls
Setlocal EnableDelayedExpansion
Set _RNDLength=12
Set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Set _Str=%_Alphanumeric%987654321
:_LenLoop
IF NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%& SET /A _Len+=9& GOTO :_LenLoop
SET _tmp=%_Str:~9,1%
SET /A _Len=_Len+_tmp
Set _count=0
SET _RndAlphaNum=
:_loop
Set /a _count+=1
SET _RND=%Random%
Set /A _RND=_RND%%%_Len%
SET _RndAlphaNum=!_RndAlphaNum!!_Alphanumeric:~%_RND%,1!
If !_count! lss %_RNDLength% goto _loop
echo Your five randomly generated passwords for you are !_RndAlphaNum!, !_RndAlphaNum!, !_RndAlphaNum!, !_RndAlphaNum! and !_RndAlphaNum!
)
echo What do you want do to? Here are a few options.
echo 1) Go back to the beginning and start again
echo 2) Exit DotPass
echo Type the number of your choice below. ( i.e 1 )
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2
if %input%==3 goto Shutdown if NOT goto Start 2
:C
cls
Setlocal EnableDelayedExpansion
Set _RNDLength=12
Set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Set _Str=%_Alphanumeric%987654321
:_LenLoop
IF NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%& SET /A _Len+=9& GOTO :_LenLoop
SET _tmp=%_Str:~9,1%
SET /A _Len=_Len+_tmp
Set _count=0
SET _RndAlphaNum=
:_loop
Set /a _count+=1
SET _RND=%Random%
Set /A _RND=_RND%%%_Len%
SET _RndAlphaNum=!_RndAlphaNum!!_Alphanumeric:~%_RND%,1!
If !_count! lss %_RNDLength% goto _loop
echo Your ten randomly generated passwords for you are !_RndAlphaNum!, !_RndAlphaNum!, !_RndAlphaNum!, !_RndAlphaNum!, !_RndAlphaNum!, !_RndAlphaNum!, !_RndAlphaNum!, !_RndAlphaNum!, !_RndAlphaNum! and !_RndAlphaNum!
echo What do you want do to? Here are a few options.
echo 1) Start again
echo 2) Exit DotPass
set input=
set /p input= Choice:
if %input%==1 goto Start2 if NOT goto Start 2
if %input%==2 goto Exit if NOT goto Start 2
if %input%==3 goto Shutdown if NOT goto Start 2
You can try it out for yourself as long as you don't publish it or modify it.
I am very new to batch scripts! Can someone help?

Using Mode Command to Resize Command prompt Clears Entire Screen

So I try Writing the codes to generate random characters and I want to make the screen always at the same size but when I tried using mode command it clears all text or you can call it entire screen
Here is the code:
:startprg
mode con: cols=120 lines=24
setlocal EnableDelayedExpansion
set char=abcdeijklmnstuvwxyzABCDETUVYZ23456789^^%%_`^^%%_`^^%%_`^^%%_`^^%%_`☺☻♥♦♣♠◘•○☺☻♥♦♣♠◘♂♀q7•-6○Z♂n¡* /*-+##$*()_=-=+
set count=0
set hla=0
:Number
set hla=120
set /a length=-1 + !hla!
:Loop
set /a count+=1
set /a rand=%Random%%%61
set buffer=!buffer!!char:~%rand%,1!
if !count! leq !length! goto Loop
title ^!buffer!
echo ^!buffer!
set /a length+=1
endlocal
goto startprg
Please help me I'm on Windows 10 and I don't know how to fix this problem
Currently each time you goto :startprg you reset the mode. Simply move the label to after mode con: in order to initiate it only once. So it should be:
#echo off
mode con: cols=120 lines=24
:startprg
setlocal EnableDelayedExpansion
So the full code would be as:
#echo off
mode con: cols=120 lines=24
:startprg
setlocal EnableDelayedExpansion
set char=abcdeijklmnstuvwxyzABCDETUVYZ23456789^^%%_`^^%%_`^^%%_`^^%%_`^^%%_`☺☻♥♦♣♠◘•○☺☻♥♦♣♠◘♂♀q7•-6○Z♂n¡* /*-+##$*()_=-=+
set count=0
set hla=0
:Number
set hla=120
set /a length=-1 + !hla!
:Loop
set /a count+=1
set /a rand=%Random%%%61
set buffer=!buffer!!char:~%rand%,1!
if !count! leq !length! goto Loop
title ^!buffer!
echo ^!buffer!
set /a length+=1
endlocal
goto startprg

How does this batch password generation work?

I am creating a password generator in batch, and had to use some help from the internet to finish it, but I am having difficulty interpreting the section of the code I had to borrow. Would someone please explain it?
:generate
#Echo Off
color 0a
set /P usernumberlength="What length do you want your password to be? "
pause
cls
Setlocal EnableDelayedExpansion
Set RNDLength=%usernumberlength%
/// from here
Set Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Set Str=%Alphanumeric%987654321
:loop
IF NOT "%Str:~18%"=="" SET Str=%Str:~9%& SET /A Length+=9& GOTO :loop
SET tmp=%Str:~9,1%
SET /A Length=Length+tmp
Set count=0
SET RndAlphaNum=
:loop2
Set /a count+=1
SET RND=%Random%
Set /A RND=RND%%%Length%
SET RndAlphaNum=!RndAlphaNum!!Alphanumeric:~%RND%,1!
If !count! lss %RNDLength% goto loop2
/// to here
Echo Password is: is !RndAlphaNum!
Echo Now choose what you want to do.
Echo 1) Go back to the beginning
Echo 2) Exit
set input=
set /p input= Choice:
if %input%==1 goto generate
if %input&==2 exit
pause
This working example (from the code you provided) contains the all-you-need section.
#echo Off
color 0a
setlocal enabledelayedexpansion
:generate
set /p usernumberlength="What length do you want your password to be? "
rem ----- begin section all you need -----
Set Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
rem "Length" is the string length of %alphanumeric%
Set Length=62
set count=0
rem "RndAlphaNum" is the output
SET RndAlphaNum=
:loop
Set /a count+=1
Set /A RND=%Random% %% %Length%
SET RndAlphaNum=!RndAlphaNum!!Alphanumeric:~%RND%,1!
if !count! lss %usernumberlength% goto loop
rem ----- end section all you need -----
echo Password is: !RndAlphaNum!
goto generate

How to fix this fibonacci batch lister?

I've researched about operand and operators, set /a , and setlocal EnableDelayedExpansion from this website but still somehow my code ends up telling
me that my operand is missing.
#echo off
cls
setlocal EnableDelayedExpansion
color 0a
title Fibonacci Lister
:Fibonacci
cls
set /a n1=1
echo %n1%
set /a n2=1
echo %n2%
set /a j=3
:loopfunction
set /a n%j%=!n%j-1%!+!n%j-2%!
echo !n%j%!
set /a j=%j%+1
goto :loopfunction
So I wanted to know what is the problem here. It is probably in line 14 where
the code is complex and hard to understand easily.
On line #14, you were using a variables named %j-1% and %j-2% which weren't declared.
Updated Script:
#echo off
setlocal EnableDelayedExpansion
color 0a
title Fibonacci Lister
:Fibonacci
set /a n1=1
echo %n1%
set /a n2=1
echo %n2%
set /a j=3
:loopfunction
set /a j1=j-1&set /a j2=j-2
set /a n%j%=!n%j1%!+!n%j2%!
if "!n%j%!"=="1836311903" goto :EOF
echo !n%j%!
set /a j=j+1
goto :loopfunction
#echo off
setlocal enableextensions disabledelayedexpansion
set n1=0
set n2=1
:loop
echo %n2%
set /a "n2=n1+n2" & set "n1=%n2%"
if %n2% gtr 0 goto loop

Resources