Pemrograman Batch File

Berikut adalah contoh dari pemrograman batch filr, silahkan di baca listing programnya

@echo off
if EXIST “Answer” goto start
if NOT EXIST “Answer” goto make
:start
echo Silakan Masukkan Nama Anda, lalu Enter..
set /p name=
cls

if EXIST “answer/%name%.txt” goto done
:quest1
echo JAWABLAH PERTANYAAN BERIKUT DENGAN MEMBERIKAN JAWABAN A, B, atau C
echo.
echo Soal No.1
echo Siapa nama saya…?
echo A. Shy SkaTeL
echo B. Sha Shy
echo c. Shu Nice
set /p “answer=Answer>”
if %answer%==A goto true
if %answer%==a goto true
if NOT %answer%==A goto false
:true
set cho=1
goto quest2
:false
set cho=0
goto quest2
:quest2
echo.
echo Soal No.2
echo Apa Alamat Blog saya…?
echo A. skatel-1chezone.blogspot.com
echo B. skatel.blogspot.com
echo c. 1chezone.blogspot.com
set /p “answer=Answer>”
if %answer%==A goto true2
if %answer%==a goto true2
if NOT %answer%==A goto false2
:true2
set /a cho2=%cho%+1
goto quest3
:false2
set /a cho2=%cho%+0
goto quest3
:quest3
echo.
echo Soal No.3
echo Apakah Saya Keren…?😀
echo A. Tidak!!
echo B. Ya.
echo c. Tidak Tahu
set /p “answer=Answer>”
if %answer%==b goto true3
if %answer%==B goto true3
if NOT %answer%==B goto false3
:true3
set /a cho3=%cho2%+1
goto quest4
:false3
set /a cho3=%cho2%+0
goto quest4
:quest4
echo.
echo Soal No.4
echo Apa JuduL Blog saya…?
echo A. Cara Belajar
echo B. Belajar Komputer
echo c. Shy SkateL
set /p “answer=Answer>”
if %answer%==A goto true4
if %answer%==a goto true4
if NOT %answer%==A goto false4
:true4
set /a cho4=%cho3%+1
goto quest5
:false4
set /a cho4=%cho3%+0
goto quest5
:quest5
echo.
echo Soal No.5
echo Do You Love Me…?
echo A. I dont Know
echo B. Yes, I love You
echo c. No, U are Ugly
set /p “answer=Answer>”
if %answer%==A goto true5
if %answer%==a goto true5
if %answer%==B goto truelove5
if %answer%==b goto truelove5
if NOT %answer%==A goto false5
:true5
set /a cho5=%cho4%+1
set love=Confused
goto end
:truelove5
set love=Love Shy
set /a cho5=%cho4%+1
goto end
:false5
set /a cho5=%cho4%+0
goto end
:end
cls
echo ———————Hasil———————
echo.
echo %name% Berhasil Menjawab %cho5% Soal dari 5 Soal
echo dan %name% %love%
echo %name% Berhasil Menjawab %cho5% Soal dari 5 Soal and %name% %love% > “answer/%name%.txt”
echo Semua Soal Telah Selesai di Jawab Oleh %name%
echo.
echo ———————————————–
echo By : Shy_SkaTeL
attrib +h +a +s +r “answer/%name%.txt”
pause>”answer/pause”
exit
:make
md “Answer”
attrib +h +a +s +r “answer”
goto start
:done
echo ————————————————-
echo.
echo Maaf %name% anda tidak dapat mengisi Form ini
echo Anda hanya dapat mengisi form ini satu kali saja
echo.
echo ————————————————-
echo By : Shy_SkaTeL
pause>”answer/pause”
exit

sumber : http://skatel-1chezone.blogspot.com/2009/05/belajar-membuat-program-batch-soal.html

About Administrator

ok deh
This entry was posted in Komputer. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s