Scripting isn't really programming. It's just to automate certain tasks. Here's some examples of what you might need to do:
SCRIPT 1: Copies SQL backup files to a different server:
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B
SET date=%yyyy%%mm%%dd%
c:
cd \BackupScripts
C:\BackupScripts\robocopy "C:\SQLBACKUPS" \\superman\Backup\MSSQL /MIR /NP /ZB /R:3 /LOG:C:\BackupScripts\robo%date%.log
cscript "C:\BackupScripts\email.vbs"
SCRIPT 2: E-mails me that SCRIPT 1 ran:
on error resume next
thisYear = year(now())
thisMonth = right("00" & month(now()), 2)
thisDay = right("00" & day(now()), 2)
myFile = "C:\BackupScripts\robo" & thisYear & thisMonth & thisDay & ".log"
Set objEmail = CreateObject("CDO.Message")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(myFile, ForReading)
Const FooterStart = " Total Copied Skipped Mismatch FAILED Extras"
Const ForReading = 1
mailbody = ""
thisline = ""
footerflag = 0
Do Until objFile.AtEndOfStream
thisline = objFile.ReadLine
if thisline = FooterStart then
footerflag = 1
end if
if footerflag = 1 then
mailbody = mailbody & thisline & chr(13)
end if
Loop
objFile.Close
objEmail.From = "MSSQLCOPY"
objEmail.To = "redacted@email.com"
objEmail.Subject = "Backup Ended: MSSQL"
strBody=""
strBody= mailbody & chr(13) & _
"============================" & chr(13) & "===== End of Message =====" & chr(13) & "============================" & chr(13) & chr(13)
objEmail.Textbody = strBody
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"slo.courts.ca.gov.s7b2.psmtp.com"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send