Top Banner

of 32

Batch Files and Scripts2.ppt

Jul 06, 2018

Download

Documents

Pamungkas Sigit
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/17/2019 Batch Files and Scripts2.ppt

    1/32

     

    Batch Files and Scripts

    Vic LauriePPCUG

    June 9, 2003

  • 8/17/2019 Batch Files and Scripts2.ppt

    2/32

     

    Why Shuld !u Care"

    #any easy$t$use, help%ul littlepr&ra's

    Psychl&ical satis%actin % nt(ein& ttally under Wind)s cntrl

    *t %r e+ery(dy (ut pr&ra''in&

    can (e %un #ae yu (etter prepared t a+id

    +iruses

  • 8/17/2019 Batch Files and Scripts2.ppt

    3/32

     

    General Pr&ra' -ypes

    C'piled Written in s'e cdin& lan&ua&e and then

    cn+erted t (inary

    ./ecuta(le that interacts )ith S directly

    ./a'ples % lan&ua&es are C and Ja+a

    1nterpreted

    -e/t %iles that reuire an inter%ace #uch sl)er (ut easy t )rite and edit

    Generically called 4scripts5 

  • 8/17/2019 Batch Files and Scripts2.ppt

    4/32

     

    C''n Scripts

    Batch %iles 6n ld %r'at )ith ne) p)er in 7P

    VBScript 8elated t +isual (asic and VB6 Ja+aScript als JScript:

    C''n n 1nternet

    *t related t Ja+a Special %iles )ith 8.G e/tensin

    Speci%ically t edit 8e&istry

  • 8/17/2019 Batch Files and Scripts2.ppt

    5/32

     

    What are Scripts Used Fr"

    8epetiti+e peratins Syste' ad'inistratin

    6ut'atin % c''n tass - carry ut a series % peratins in

    ne step

    - help )ith %ile 'ana&e'ent - 'ae 8e&istry chan&es

  • 8/17/2019 Batch Files and Scripts2.ppt

    6/32

     

    What is a Batch File"

    6 te/t %ile )ith e/tensin B6-cntainin& a seuence % c''ands

    1nterpreter is command.com in;S

  • 8/17/2019 Batch Files and Scripts2.ppt

    7/32 

    ./a'ple % Batch File

     4Cleant'p=(at5  del C>?)ind)s?te'p?@=t'p

    *te use % )ildcard 4@5  #re sphisticated +ersin in 7P can

    ha+e s)itches and ln& %ile na'es del

  • 8/17/2019 Batch Files and Scripts2.ppt

    8/32 

    6nther ./a'ple

    Wind)s 97?)ind)s

    deltree

  • 8/17/2019 Batch Files and Scripts2.ppt

    9/32 

    Batch Files %r Clean Up

    Fred Lan&a at )))=lan&a=c'

  • 8/17/2019 Batch Files and Scripts2.ppt

    10/32 

    Fr Bacup

    Can use 4/cpy5 )ith +ariuss)itches

    Fr e/a'ple /cpy %lder %lder2 date:

    ;ate %r'at ''$dd$yyyy

    r /cpy %lder %lder2

  • 8/17/2019 Batch Files and Scripts2.ppt

    11/32 

    8e%erence %r Bacup Files

    Fred Lan&a at )))=lan&a=c'

  • 8/17/2019 Batch Files and Scripts2.ppt

    12/32 

    6r&u'ents Placehlders:

    Batch %iles can accept input Use placehlders ar&u'ents:

    /cpy 2 1% (atch %ile called 4(acup=(at5 

    .nter 4(acup=(at %lder %lder25 in

    c''and line Be care%ul a(ut paths

  • 8/17/2019 Batch Files and Scripts2.ppt

    13/32 

    6 Fe) % the C''ands

    attri(

    cpy

    del dir

    'd

    rd ren

    /cpy

    assc, %type

    %indstr

    pushd, ppd re&

    shutd)n

    %r &t

    i% 

  • 8/17/2019 Batch Files and Scripts2.ppt

    14/32 

    Fr elp

    .nter 4help5 in c''and line nt inWind)s #e:

    .nter 4command   

  • 8/17/2019 Batch Files and Scripts2.ppt

    15/32 

    S'e 8e%erences

    http>

  • 8/17/2019 Batch Files and Scripts2.ppt

    16/32 

    Scripts VBS and JS:

    -) inter%aces Wind)s Script st

    Fr scripts run lcally

    as access t %ile syste' and 8e&istry

    Br)ser

    Fr scripts n 1nternet

    ;es nt ha+e access t %ile syste'

    VBS nt read (y *etscape ne)er +ersin":

    Bth can read and pass scripts t thescriptin& 4en&ine5 

  • 8/17/2019 Batch Files and Scripts2.ppt

    17/32 

    VBScripts vs Batch Files

    #re riented t user interactin Can (e &raphical r c''and line

    Greater cntrl % ther pr&ra's as p)er%ul %ile syste' %unctins

    Can edit 8e&istry

    (ect riented

    arder t learn and pr&ra'

  • 8/17/2019 Batch Files and Scripts2.ppt

    18/32 

    S'e Use%ul VBScripts

    1ncrease icn cache Scandis and de%ra& all dri+es aut'atically Clean te'p %iles

    Selecti+ely clean 4cies5  Bacup %lders and %iles Get prduct ey %r Wind)s Chan&e re&istered )ner

    Carry ut tass at shutd)n File assciatin %i/es Varius edits t 8e&istry 6dd t Cnte/t #enu

  • 8/17/2019 Batch Files and Scripts2.ppt

    19/32 

    S'e Surces % VBScripts

    http>

  • 8/17/2019 Batch Files and Scripts2.ppt

    20/32

    'ScanFragAll.vbs - ScanDisk and DeFragon all hard drives.'© Bill James - [email protected] rev 1 !c" 1###!$"ion %&$lici"

    Dim shShellSe" shShell (Scri$".)rea"e!bjec"*+Scri$".Shell+,shShell.n +scandsk/ 0all 0n

    0silen"+1"reshShell.n +de2rag 0all0no$rom$"+1"re

  • 8/17/2019 Batch Files and Scripts2.ppt

    21/32

     

    VBScripts and Viruses

    S'e +iruses are in %r' %VBScripts

    6nti$+irus pr&ra's 'ay (lc use% scripts

    . K 'ay nt all) d)nladin& %

    attach'ents )ith VBS and ther:e/tensins

  • 8/17/2019 Batch Files and Scripts2.ppt

    22/32

  • 8/17/2019 Batch Files and Scripts2.ppt

    23/32

  • 8/17/2019 Batch Files and Scripts2.ppt

    24/32

     

    Ja+aScript and JScript

    ./tensi+ely used n We( pa&es it cunters, tdays date, etc 

    Whle li(raries % scripts a+aila(le %r(uddin&We('asters

    *t used as 'uch %r lcal

    c'puters

  • 8/17/2019 Batch Files and Scripts2.ppt

    25/32

     

    B'arlets

    http>

  • 8/17/2019 Batch Files and Scripts2.ppt

    26/32

  • 8/17/2019 Batch Files and Scripts2.ppt

    27/32

  • 8/17/2019 Batch Files and Scripts2.ppt

    28/32

     

     48.G5 Files

    Special te/t %iles )ith e/tensin 8.G

    ;u(le$clicin& 'di%ies a sectin %

    the 8e&istry Can add, delete, r 'di%y eys and

    +alues

    Can d)nlad use%ul 8e&istryt)eas

  • 8/17/2019 Batch Files and Scripts2.ppt

    29/32

    REGEDIT4

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Wi!ows\C"rret#ersio\e$%&orer'

    (Ma$ Cac*e! Icos(+(4,-.(

  • 8/17/2019 Batch Files and Scripts2.ppt

    30/32

     Wi!ows Re/istr0 E!itor #ersio 12,,

    [HKEY_LOCAL_MACHINE\SO3TWARE\C&asses

    \A&&3i&es0steO56ects\s*e&&e$'

    [HKEY_LOCAL_MACHINE\SO3TWARE\C&asses

    \A&&3i&es0steO56ects\s*e&&e$\Cote$tMe"Ha!&ers'

    [HKEY_LOCAL_MACHINE\SO3TWARE\C&asses

    \A&&3i&es0steO56ects\s*e&&e$\Cote$tMe"Ha!&ers\Co%0 To'

    7+(8C93::.;,>D>?C;@(

    [HKEY_LOCAL_MACHINE\SO3TWARE\C&asses

    \A&&3i&es0steO56ects\s*e&&e$\Cote$tMe"Ha!&ers\Moe To'

    7+(8C93::.;>>D>?C;@(

    [HKEY_LOCAL_MACHINE\SO3TWARE\C&asses

    \A&&3i&es0steO56ects\s*e&&e$\Cote$tMe"Ha!&ers\Se! To'

    7+(8=:A4C=4,>C3

  • 8/17/2019 Batch Files and Scripts2.ppt

    31/32

     

    Surces % 8.G Files

    http>

  • 8/17/2019 Batch Files and Scripts2.ppt

    32/32