Jump to content
Sign in to follow this  
meisme

Tolong Fix Batch Command Nihh....

Recommended Posts

sesapa leh tlg fix benda nih

CODE
@echo off
:a
if 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 password
set/p "passw=>"
if not %passw%==%a%%b% goto wrong
goto mdir
:wrong
echo invalid
pause
goto a
:mdir
echo success
pause
exit


Share this post


Link to post
Share on other sites
unsure.gif unsure.gif 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? unsure.gif wacko.gif

Share this post


Link to post
Share on other sites
CODE
@echo off
:a
if 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 password
set /p passw =
if not '%passw%==%a%%b%' goto wrong
goto mdir
:wrong
echo invalid
pause
goto a
:mdir
echo success
pause
exit





http://www.infionline.net/~wtnewton/batch/batchfaq.html

Share this post


Link to post
Share on other sites
QUOTE(meisme @ Nov 25 2008, 12:12 PM) <{POST_SNAPBACK}>
unsure.gif unsure.gif 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? unsure.gif wacko.gif

Still kurng faham ph34r.gif
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
:a
if exist "a.txt" set /p a= <a.txt
if exist "a2.txt" set /p b= <a2.txt
echo Enter your password
set /p passw=
if %passw%==%a%%b% goto mdir
goto wrong
:wrong
echo invalid
pause
goto a
:mdir
echo success
pause
exit

Share this post


Link to post
Share on other sites
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 off
color fc
title Testing Batch File : PassworD

:a
cls
if exist "a.txt" do set %a%=a
if exist "b.txt" do set %a%=b
if exist "1.txt" do set %a%=1
if exist "2.txt" do set %a%=2
if exist "a2.txt" do set %b%=a
if exist "b2.txt" do set %b%=b
if exist "12.txt" do set %b%=1
if exist "22.txt" do set %b%=2

echo.
set passw=
set /p passw=Enter your password:
if %passw%==%a%%b% goto mdir
goto wrong


:wrong
echo. invalid
pause >nul
goto a

:mdir
echo. success
pause >nul
exit
Edited by mikicun

Share this post


Link to post
Share on other sites
ok
program sbenarnya mcm ni:

CODE
@echo off
:create
echo create your password
if exist ??.txt goto msj
set/p "pass=>"
if %pass%==aa goto a
if %pass%==ab goto b
if %pass%==a1 goto c
if %pass%==a2 goto d
if %pass%==ba goto e
if %pass%==bb goto f
if %pass%==b1 goto g
if %pass%==b2 goto h
if %pass%==1a goto i
if %pass%==1b goto j
if %pass%==11 goto k
if %pass%==12 goto l
if %pass%==2a goto m
if %pass%==2b goto n
if %pass%==21 goto o
if %pass%==22 goto p
echo invalid charecter
pause
goto create
:a
echo a >> a.txt
echo a2 >> a2.txt
goto msj
:b
echo a >> a.txt
echo b2 >> b2.txt
goto msj
:c
echo a >> a.txt
echo 12 >> 12.txt
goto msj
:d
echo a >> a.txt
echo 22 >> 22.txt
goto msj
:e
echo b >> b.txt
echo a2 >> a2.txt
goto msj
:f
echo b >> b.txt
echo b2 >> b2.txt
goto msj
:g
echo b >> b.txt
echo 12 >> 12.txt
goto msj
:h
echo b >> b.txt
echo 22 >> 22.txt
goto msj
:i
echo 1 >> 1.txt
echo a2 >> a2.txt
goto msj
:j
echo 1 >> 1.txt
echo b2 >> b2.txt
goto msj
:k
echo 1 >> 1.txt
echo 12 >> 12.txt
goto msj
:l
echo 1 >> 1.txt
echo 22 >> 22.txt
goto msj
:m
echo 2 >> 2.txt
echo a2 >> a2.txt
goto msj
:n
echo 2 >> 2.txt
echo b2 >> b2.txt
goto msj
:o
echo 2 >> 2.txt
echo 12 >> 12.txt
goto msj
:p
echo 2 >> 2.txt
echo 22 >> 22.txt
goto msj

:msj
if exist "a.txt" goto msja
if exist "b.txt" goto msjb
if exist "1.txt" goto msjc
if exist "2.txt" goto msjd

:msja
if exist "a2.txt" goto msja2
if exist "b2.txt" goto msjb2
if exist "12.txt" goto msj12
if exist "22.txt" goto msj22


:msja2
cls
echo Enter your password
set/p "passw=>"
if not %passw%==aa goto wrong
goto mdir

:wrong
echo invalid password
pause
exit

:mdir
if exist "succes" goto clr
md Succes
echo this program succes
pause
exit

:clr
rd succes
goto mdir


tp 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}>
CODE
sesapa leh tlg fix benda nih

@echo off
color fc
title Testing Batch File : PassworD
:a
cls
if exist "a.txt" do set %a%=a
if exist "b.txt" do set %a%=b
if exist "1.txt" do set %a%=1
if exist "2.txt" do set %a%=2
if exist "a2.txt" do set %b%=a
if exist "b2.txt" do set %b%=b
if exist "12.txt" do set %b%=1
if exist "22.txt" do set %b%=2

echo.
set passw=
set /p passw=Enter your password:
if %passw%==%a%%b% goto mdir
goto wrong

:wrong
echo. invalid
pause >nul
goto a

:mdir
echo. success
pause >nul
exit


xpaham pon.... jadi lg truk laaaa....

Share this post


Link to post
Share on other sites
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:

CODE
echo create your password
if exist ??.txt goto msj
set/p "pass=>"
if %pass%==aa goto a


Dia 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
:a
echo a >> a.txt
echo a2 >> a2.txt
goto msj


Kat 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
:msj
if exist "a.txt" goto msja
if exist "b.txt" goto msjb
if exist "1.txt" goto msjc
if exist "2.txt" goto msjd


Skali lg cam kt atas. Hanya a2.txt je ade, so pe gune cek lain2 tu?
Sbb a2.txt ade, kte g ke msja2:
CODE
:msja
if exist "a2.txt" goto msja2
if exist "b2.txt" goto msjb2
if exist "12.txt" goto msj12
if exist "22.txt" goto msj22


Skang 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
:msja2
cls
echo Enter your password
set/p "passw=>"
if not %passw%==aa goto wrong
goto mdir


Kesimpulannya aku x pham ape yang ko nk capai @ buat ngan program ni ph34r.gif

Share this post


Link to post
Share on other sites
ok...
dh bleh dah....
tq all 4 help

CODE
@echo off
:a
cls
if exist "a.txt" set /p a= <a.txt
if not exist "a.txt" goto crt
echo Enter your password
set /p passw=
if %passw%==%a% goto mdir
if %passw%==renew goto crt
goto wrong
:crt
del a.txt
cls
echo Create password
set /p cre=
if %cre%==renew goto wrong2
echo %cre% >> a.txt
goto a
:wrong
cls
echo invalid
pause
goto a
:mdir
cls
echo success
pause
exit
:wrong2
cls
echo cannot set password to RENEW
echo RENEW for change password only!!
pause
goto crt

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...