Thursday, August 28, 2008

operating system (batch programming)


example:

Prompt for user input

@echo off
Set /P _dept=Please enter Department:
If "%_dept%"=="" goto :sub_error
If /i "%_dept%"=="finance" goto sub_finance
If /i "%_dept%"=="hr" goto sub_hr
goto:eof

:sub_finance
echo You chose the finance dept
goto:eof

:sub_hr
echo You chose the hr dept

http://www.ss64.com/nt/set.html


example create directory user input directory

SET /P cname=[Enter Last Name]
MKDIR %cname%
CD %cname%
MKDIR subdir1
MKDIR subdir2

http://techrepublic.com.com/5208-11196-0.html?forumID=51&threadID=181002&messageID=1844578

Changing the Current drive

simply enter the drive letter followed by a colon
C:> E:
E:>

To change drive and directory at the same time, use CD with the /D switch
C:> cd /D E:\utils
E:\utils\>

"Change is the law of life. And those who look only to the past or the present are certain to miss the future" - John F. Kennedy

http://www.ss64.com/nt/cd.html


wa~~..changing the current drive ni la aku terkial2 cr..tah pe2 aku try..

aku nk wat dr c drive ke thumbdrive..

tulih (c:>cd h: )camni banyak kali,tah pe2 la..upe2 nye..(c:>h:)bengang gile aku..waaa~!!tensen2..hanye 2 mende je..huruf h ngn double dot je..menci2..

pastue,nk change balek kat c drive..yo yo a je aku wat macam2..

cth cam:(cd /D E:\utils)..mmg aku tak ltk utils tu,utils tu name folder dier..bodo ar kalo wat camtu..ni ha..aku just change current drive je, aku wat camni...cd /d e:..wat la..byk2 kali,aku ingat same cam kat atas ni..penatla dok oter2..

upe2 nye,(cd /D E:\)ni je...wa...tak ltk slash..tah pe2 la..menci2!!


No comments: