meisme 0 Report post Posted November 24, 2008 sesapa leh tlg fix benda nihCODE@echo off:aif exist "a.txt" set "%a%=a"if exist "b.txt" set "%a%=b"if exist "1.txt" set "%a%=1"if exist "2.txt" set "%a%=2"if exist "a2.txt" set "%b%=a"if exist "b2.txt" set "%b%=b"if exist "12.txt" set "%b%=1"if exist "22.txt" set "%b%=2"echo Enter your passwordset/p "passw=>"if not %passw%==%a%%b% goto wronggoto mdir:wrongecho invalidpausegoto a:mdirecho successpauseexit Quote Share this post Link to post Share on other sites
johnburn 6 Report post Posted November 25, 2008 xpham ape yg ko nk wat cube terangkn ape yg ko nk wat, nt aku try tlg Quote Share this post Link to post Share on other sites
meisme 0 Report post Posted November 25, 2008 sinopsis:aku nak wat batch file 2 memula check *.txt file, klu jump file tu dia akan set kpd %a% n %b%,pas2 %a% n %b% dia akan declare sbg password, kemudian bila %passwd% sama ngn %a% n %b% program ni akan echo success, klu x dia akan echo invalid.....camna? Quote Share this post Link to post Share on other sites
Bakri_ 0 Report post Posted November 25, 2008 CODE@echo off:aif exist "a.txt" set "%a%=a"if exist "b.txt" set "%a%=b"if exist "1.txt" set "%a%=1"if exist "2.txt" set "%a%=2"if exist "a2.txt" set "%b%=a"if exist "b2.txt" set "%b%=b"if exist "12.txt" set "%b%=1"if exist "22.txt" set "%b%=2"echo Enter your passwordset /p passw =if not '%passw%==%a%%b%' goto wronggoto mdir:wrongecho invalidpausegoto a:mdirecho successpauseexithttp://www.infionline.net/~wtnewton/batch/batchfaq.html Quote Share this post Link to post Share on other sites
johnburn 6 Report post Posted November 25, 2008 QUOTE(meisme @ Nov 25 2008, 12:12 PM) <{POST_SNAPBACK}> sinopsis:aku nak wat batch file 2 memula check *.txt file, klu jump file tu dia akan set kpd %a% n %b%,pas2 %a% n %b% dia akan declare sbg password, kemudian bila %passwd% sama ngn %a% n %b% program ni akan echo success, klu x dia akan echo invalid.....camna? Still kurng faham Kl ko nk value password tu same ngan string yg ade dlm a.txt dan a2.txt (disimpan dlm variable %a%b%), ko bleh wat gini:CODE@echo off:aif exist "a.txt" set /p a= <a.txtif exist "a2.txt" set /p b= <a2.txtecho Enter your passwordset /p passw=if %passw%==%a%%b% goto mdirgoto wrong:wrongecho invalidpausegoto a:mdirecho successpauseexit Quote Share this post Link to post Share on other sites
mikicun 0 Report post Posted November 25, 2008 (edited) still ada sikit error... nanti aku sambung balik...QUOTE(meisme @ Nov 24 2008, 07:44 PM) <{POST_SNAPBACK}>sesapa leh tlg fix benda nih@echo offcolor fctitle Testing Batch File : PassworD :aclsif exist "a.txt" do set %a%=aif exist "b.txt" do set %a%=bif exist "1.txt" do set %a%=1if exist "2.txt" do set %a%=2if exist "a2.txt" do set %b%=aif exist "b2.txt" do set %b%=bif exist "12.txt" do set %b%=1if exist "22.txt" do set %b%=2echo.set passw=set /p passw=Enter your password: if %passw%==%a%%b% goto mdirgoto wrong :wrong echo. invalidpause >nul goto a :mdir echo. success pause >nul exit Edited November 25, 2008 by mikicun Quote Share this post Link to post Share on other sites
meisme 0 Report post Posted November 27, 2008 okprogram sbenarnya mcm ni:CODE@echo off:createecho create your passwordif exist ??.txt goto msjset/p "pass=>"if %pass%==aa goto aif %pass%==ab goto bif %pass%==a1 goto cif %pass%==a2 goto dif %pass%==ba goto eif %pass%==bb goto fif %pass%==b1 goto gif %pass%==b2 goto hif %pass%==1a goto iif %pass%==1b goto jif %pass%==11 goto kif %pass%==12 goto lif %pass%==2a goto mif %pass%==2b goto nif %pass%==21 goto oif %pass%==22 goto pecho invalid charecterpausegoto create:aecho a >> a.txtecho a2 >> a2.txtgoto msj:becho a >> a.txtecho b2 >> b2.txtgoto msj:cecho a >> a.txtecho 12 >> 12.txtgoto msj:decho a >> a.txtecho 22 >> 22.txtgoto msj:eecho b >> b.txtecho a2 >> a2.txtgoto msj:fecho b >> b.txtecho b2 >> b2.txtgoto msj:gecho b >> b.txtecho 12 >> 12.txtgoto msj:hecho b >> b.txtecho 22 >> 22.txtgoto msj:iecho 1 >> 1.txtecho a2 >> a2.txtgoto msj:jecho 1 >> 1.txtecho b2 >> b2.txtgoto msj:kecho 1 >> 1.txtecho 12 >> 12.txtgoto msj:lecho 1 >> 1.txtecho 22 >> 22.txtgoto msj:mecho 2 >> 2.txtecho a2 >> a2.txtgoto msj:necho 2 >> 2.txtecho b2 >> b2.txtgoto msj:oecho 2 >> 2.txtecho 12 >> 12.txtgoto msj:pecho 2 >> 2.txtecho 22 >> 22.txtgoto msj:msjif exist "a.txt" goto msjaif exist "b.txt" goto msjbif exist "1.txt" goto msjcif exist "2.txt" goto msjd:msjaif exist "a2.txt" goto msja2if exist "b2.txt" goto msjb2if exist "12.txt" goto msj12if exist "22.txt" goto msj22:msja2clsecho Enter your passwordset/p "passw=>"if not %passw%==aa goto wronggoto mdir:wrongecho invalid passwordpauseexit:mdirif exist "succes" goto clrmd Succesecho this program succespauseexit:clrrd succesgoto mdirtp ini just contoh je. so aku x wat bagi abih la. just set password utk aa ja..kalau nak wat sampai abih, bat file 2 cecah MB gak la.. tp kalau program 2 leh guna comman SET simple la jgk....QUOTE(mikicun @ Nov 25 2008, 04:47 PM) <{POST_SNAPBACK}>CODEsesapa leh tlg fix benda nih@echo offcolor fctitle Testing Batch File : PassworD:aclsif exist "a.txt" do set %a%=aif exist "b.txt" do set %a%=bif exist "1.txt" do set %a%=1if exist "2.txt" do set %a%=2if exist "a2.txt" do set %b%=aif exist "b2.txt" do set %b%=bif exist "12.txt" do set %b%=1if exist "22.txt" do set %b%=2echo.set passw=set /p passw=Enter your password: if %passw%==%a%%b% goto mdirgoto wrong :wrongecho. invalidpause >nulgoto a:mdirecho. successpause >nulexitxpaham pon.... jadi lg truk laaaa.... Quote Share this post Link to post Share on other sites
johnburn 6 Report post Posted November 27, 2008 Haha aku totally lost ngan ape ko nk wat. Whats the point of all those txt file?Ok, kl first kt create aku type aa:CODEecho create your passwordif exist ??.txt goto msjset/p "pass=>"if %pass%==aa goto aDia akn create 2 text file. Satu a.txt ngan string a dlm tu. Satu lg a2.txt ngan string a2 dlm tu. Kemudian die akn g ke msj:CODE:aecho a >> a.txtecho a2 >> a2.txtgoto msjKat msj lak, die cek samada file a.txt, b.txt, 1.txt, dan 2.txt ade ke x. Ape gune cek file2 lain tu sdngkn td kte just create a.txt ngan a2.txt je. Sbb a.txt ade, kite akn g ke msja:CODE:msjif exist "a.txt" goto msjaif exist "b.txt" goto msjbif exist "1.txt" goto msjcif exist "2.txt" goto msjdSkali lg cam kt atas. Hanya a2.txt je ade, so pe gune cek lain2 tu?Sbb a2.txt ade, kte g ke msja2:CODE:msjaif exist "a2.txt" goto msja2if exist "b2.txt" goto msjb2if exist "12.txt" goto msj12if exist "22.txt" goto msj22Skang kne mskkn password. Kte smpai kt msja2 ni sbb file a.txt ngan a2.txt ade. File a.txt ngan a2.txt ni plak ade sbb kte plih aa kt atas td. So kt sini die cek password tu equals tu aa atau x. Kl ye success, kl x g ke wrong.CODE:msja2clsecho Enter your passwordset/p "passw=>"if not %passw%==aa goto wronggoto mdirKesimpulannya aku x pham ape yang ko nk capai @ buat ngan program ni Quote Share this post Link to post Share on other sites
mikicun 0 Report post Posted November 27, 2008 laa..... kan aku cakap tak abis lagi skrip tuh....amik buku nih dan baca.... complete tutorial dan sample untuk scripting... Quote Share this post Link to post Share on other sites
meisme 0 Report post Posted November 27, 2008 ok...dh bleh dah....tq all 4 helpCODE@echo off:aclsif exist "a.txt" set /p a= <a.txtif not exist "a.txt" goto crtecho Enter your passwordset /p passw=if %passw%==%a% goto mdirif %passw%==renew goto crtgoto wrong:crtdel a.txtclsecho Create passwordset /p cre=if %cre%==renew goto wrong2echo %cre% >> a.txtgoto a:wrongclsecho invalidpausegoto a:mdirclsecho successpauseexit:wrong2clsecho cannot set password to RENEWecho RENEW for change password only!!pausegoto crt Quote Share this post Link to post Share on other sites