Filet Batch Dhe Skriptet

Embed Size (px)

Citation preview

Batch Files and Scripts

Batch Files dhe ScriptsMSc. Ing. Deivis DISHAPse duhet te shqetesohemi?Shume te lehte ne perdorim,Programe te vegjel ndihmese.Kenaqesi psikologjike per arsye se nuk jemi te kontrolluar totalisht nga windowsJo per cdo person, por programimi mund te duket interesantJu pergatit per te shmangur viruset

Tipet e programeve te pergjithshmeTe kompiluarTe shkruajtur ne disa gjuhe kodimi dhe me pas te konvertuara ne binareTe ekzekutueshme te cilat interaktojne direkt me OS Shembuj gjuhesh jane C dhe javaTe interpretuaraText files te cilat kane nevoje per nje nderfaqeShume te ngadalta por te thjeshta per te shkruajtur dhe per te edituar.Pergjithesisht quhen scriptsSkriptet e zakonshmeBatch filesNje format I vjeter me nje fuqi te re tek XPVBScriptI lidhur me visual basic and VBA(Visual Basic for Applications)JavaScript (gjithashtu JScript)Te zakonshem ne InternetNuk kane lidhje me JavaFile te vecante me prapashtesen REG Ne menyre specifike per editim e RegistryPer cfare perdoren Skriptet?Operacione perseriteseSystem administrationAutomatizimin e tasks te njejtePer te mbajtur nje seri operacionesh ne nje hapPer te ndihmuar me menaxhimin e filevePer te bere ndryshime ne regjistra

Cfare eshte nje Batch file?Nje text file me prapashtesen BAT I cili permban nje sekuence komandashInterpreter eshte command.com tek DOS/Windows 9x/MeKomandat jane DOS plus disa futje variablash dhe degeshInterpreter eshte cmd.exe tek XPKomandat disponibel jane me te gjithanshme dhe jane 32 bit-sheShembull I nje Batch FileCleantmp.batdel C:\windows\temp\*.tmpVini re perdorimin e shenjes*Versione me te sofistikuar te XP mund te kene emra me te gjate del /s/q C:\windows\temp\*.tmpMund te shtojme me shume rreshtaPer te pastruar cachene e internetit , etjNje shembull tjeter(Windows 9X/Me)cd C:\windowsdeltree /y temp\deltree /y tempor~1\deltree /y cookies\

Perdor del dhe rd tek XP me /sBatch Files per te pastruarFred Langa atwww.langa.com/cleanup_bat.htm www.langa.com/newsletters/2002/2002-04-04.htm#2Per BackupMund te perdorimxcopyme variacione te ndryshme(switches)Per shembullxcopy folder1 folder2 /d:(date)Date format mm-dd-yyyyOr xcopy folder1 folder2 /uOr xcopy folder1 folder2 /s/u

Referenca per Backup FilesFred Langa atwww.langa.com/backups/backups.htmArgumentat (Placeholders)Batch files mund te pranojne inputePerdor placeholders (argumentat)xcopy %1 %2 Nqs nje batch file quhetbackup.batFusni backup.bat folder1 folder2 ne command lineKujdes me pathet

Disa nga komandatattribcopydeldirmdrdrenxcopyassoc, ftypefindstrpushd, popdregshutdownforgotoif

Per ndihme(Help)Fusni help ne command line (jo ne Windows Me)Fusni command /? si tekxcopy /? per te marre informacionin per komanden specifikeNe Windows XP Pro fusni hh ntcmds.chm in Start|Run per ndihme te gjere te command line Disa referencahttp://www.microsoft.com/technet/treeview/default.asp?url=/TechNet/prodtechnol/winxppro/proddocs/batch.asphttp://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/winxppro/proddocs/ntcmds.asp Scripts (VBS dhe JS)VisualBasicScripting Edition dhe Java ScriptDy nderfaqeWindows Script HostFor scripts te cilat ekzekutohen lokalisht Ka akses tek filet e sistemit dhe ne regjistra BrowserPer skripte ne internetNuk ka akses tek filet e sistemitVBS nuk lexon nga NetscapeTe dyja mund te lexojne dhe te kalojne skripte tek makina e skripteveVBScripts vs Batch FilesMe shume te orientuara tek nderfaqesimi me perdoruesinMund te jene grafike ose command lineMe shume kontroll tek programet e tjereKa funksione te fuqishme te fileve te sistemitMund te editoje RegistryObject orientedI veshtire per tu mesuar dhe programuarDisa VBScripts te nevojshmeRritja e cache-se se ikonaveScandisk dhe defrag te te gjithe drives ne menyre automatikePastrimi I temp filesPastron ne menyre selektivecookiesBackup I folderave dhe fileveTe marrim product key per WindowsTe nderrojme pronarin e regjistruarTe kryejme veprime me shutdownFile association fixesEditime te ndryshme tek Registry

Burime per VBScriptshttp://billsway.com/vbspage/http://www.dougknox.com/http://www.kellys-korner-xp.com/xp_tweaks.htm

'ScanFragAll.vbs - ScanDisk and DeFrag on all hard drives.Option ExplicitDim WshShellSet WshShell = WScript.CreateObject("WScript.Shell")WshShell.Run "scandskw /all /n /silent",1,trueWshShell.Run "defrag /all /noprompt",1,trueVBScripts dhe VirusetDisa viruse jane ne formen e VBScriptsProgramet e antiviruseve mund te bllokojne perdorimin e scripteveOE(outlook Express)mund te mos lejoje downlodimin e attachments me VBS (ose me prapashtesa te tjera)

JavaScript dhe JScriptECMAScriptstandard-Windows ScriptenginePerdoret gjeresisht ne faqet WebQellon numeruesit, todays date, etcTe gjitha librarite e skripteve jane te disponueshme per Webmasterat fillestareNuk perdoren per local compBookmarkletshttp://www.bookmarklets.com/JavaScripts shume te shkurter te cilet mund te shtohen tek FavoritesShton funksione te dobishme tek browseri

Filet REG File text te vecante me prapashtesen REGKur kryejme Double-clicking modifikojme nje seksion tek RegistryMund te shtojme te fshijme te modifikojme celesat ose vleratREGEDIT4

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\explorer]"Max Cached Icons"="4096"Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AllFilesystemObjects\shellex]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AllFilesystemObjects\shellex\ContextMenuHandlers]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AllFilesystemObjects\shellex\ContextMenuHandlers\Copy To]@="{C2FBB630-2971-11D1-A18C-00C04FD75D13}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AllFilesystemObjects\shellex\ContextMenuHandlers\Move To]@="{C2FBB631-2971-11D1-A18C-00C04FD75D13}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AllFilesystemObjects\shellex\ContextMenuHandlers\Send To]@="{7BA4C740-9E81-11CF-99D3-00AA004AE837}"

Burimet e fileve REGhttp://www.aumha.org/regfiles.htmhttp://home.satx.rr.com/badour/html/reg_files.htmlhttp://www.kellys-korner.com/registry_fixes.htmFaleminderit per Vemendjen !