Introduzione - I.I.S.Galilei Crema
Transcript
Introduzione - I.I.S.Galilei Crema
Classe 4 IB Sistemi Operativi ed Interfaccia Utente Il DOS e la programmazione Batch ! ! " # # % , $ 7 , &'() - ) /44.( # * $ + ) # . / 0 12 13 * * # 5& 6 ( * 8 $ % #8 ) , .111 ; 6 < 6 % < ( # = $ 9) 9 < 6 # ': &' ; 6 > $ () # * " + ? ) > # . / 0 12 ) # 13 * ,- > < 6 ; 6 ! ! " ! # $% # < ! @ " # & A; B-: ) A ! ; 6 8 C Classe 4 IB : Sistemi Operativi ed Interfaccia Utente Il DOS e la programmazione Batch ! " C / > D # 7 ' A " " C C A A A A : > C ; " # & ! '( : + & C 8 C ? + <comando> [ < opzioni > ] [ <argomenti>] " 4 . > ( ( + C:\>dir < C:\>dir /s < C:\>dir w*.doc : C:\>dir ..\doc\* < C:\>dir /? : & - ) -' ; 6 )* #) + ,-. DIR ls : CD newdir cd newdir ' CD \dir1\dir2 cd /dir1/dir2 ' CD .. cd .. MD newdir mkdir newdir ' REN file1 file2 mv file1 file2 F TYPE file.txt less file.txt 7 COPY file1 file2 cp file1 file2 ' DEL fille1 rm file1 ' E . . / / . + Classe 4 IB Sistemi Operativi ed Interfaccia Utente Il DOS e la programmazione Batch * ,! ) # $ ; 6< 6( % / %( <! $ / $ % ! G 9 , 9 ! ! % $ " $ > % H H$ H$ H < $ + 8 " 9 9 % 8 % % ( ! $ $ ! ( ! ; 6 * ,- 0 1 2-.0 ?) ( # ?/4445& $ 9'*-9 ! > $ : : " ! ( + @ I.( G J! : @echo off if %1 == %2 goto uguale if not %1 == %2 goto diverso :uguale echo %1 è uguale a %2 goto fine :diverso echo %1 è diverso da %2 :fine @ ! + uguale abc abc + uguale abc cde I/ " Classe 4 IB Sistemi Operativi ed Interfaccia Utente Il DOS e la programmazione Batch & ( 'K : choice /C:[elenco lettere]/N/Tn,C prompt + ' ! $ ? if & errorlevel goto < choice L 9 + 9 $ L 8 errorlevel rem ( L ' pause. % : + @echo off echo Menù.. scegli! Choice /C:den Dir,Edit,Nulla If errorlevel 3 goto dirr If errorlevel 2 goto editt If errorlevel 1 goto nulla :dirr dir goto nulla :editt edit goto nulla :nulla if (if exist goto ; $ $ not exist : @echo off REM controlla che esiste autoexec.bat if exist c:\autoexec.bat goto si if not exist c:\autoexec.bat goto no :si echo Autoexec.bat esiste goto fine :no echo Autoexec.bat non esiste :fine if Classe 4 IB Sistemi Operativi ed Interfaccia Utente Il DOS e la programmazione Batch FOR : %variabile IN (tipo di file) DO comando & + @echo off echo Ricerchero tutti i file con estenzione %1 for %%i in (%1) do echo %%i 9 I9 I. 9 ?5?9 > " + C:\DOS\>lista *.txt 3 & $ & $ C:\DOS\>DIR *.txt >lista.txt C:\DOS\>dir *.txt >PRN ! " # C:\DOS\>dir *.txt >nul > 4 ! 5 ' +echo 9 K & ) M 9 @echo off dir *.txt echo Hello Word! echo off @ Hello Word echo Classe 4 IB Sistemi Operativi ed Interfaccia Utente Il DOS e la programmazione Batch -$$ 6 / & / < ; 6 - D> K < 6 < % N O P&>?K ! 4 % ' ! ! ( " C > K '+ C:\Programmi\Adobe> CD C:\Programmi\Adobe < & ( D>'B < >K & % - \ ; 6< 6 .. C " < >K / ( $ - C ) + $ # ( ! P' *$ P:5:$ 8! $ $ PD>?$ $ P' **> -' *$ < $ ( G ( $ &>?K " " :5: ' * D>?