Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Create a batch file (hw3_yourlastname1.bat) which will schedule tasks on the

ID: 3590474 • Letter: 1

Question

1. Create a batch file (hw3_yourlastname1.bat) which will schedule tasks on the system using Windows 7’s Scheduled Task Console utility - schtasks (60%)

Your batch file (hw3_yourlastname1.bat) will include instructions to do the followings:

i. List the directories and files in the current directory

ii. Pause the script to see the list of directories and files

iii. Clear the screen iv. Pause the script

v. Schedule a task to start Check Disk (chkdsk.exe) every Friday at 5:30pm using Scheduled Task Console

vi. Schedule a task to start Disk Defragmenter (dfrgui.exe) every 1 st day of a month at 11:30pm using Scheduled Task Console

vii. Display all the scheduled tasks on the system

viii. Pause the script to see the list of scheduled tasks

2. Windows Script Host (WSH) facilitates developing scripts for Windows 7 using scripting languages such as Visual Basic.

a. Write down a visual basic script (hw3_yourlastname2.vbs) which will display the current user’s login name, computer name, domain name and user profile (home folder) in a message box (20%)

b. Write down a visual basic script (hw3_yourlastname3.vbs) which will list all the printers (including virtual ones such as Adobe Writer) and their assigned port(s) defined on your machine (20%)

Explanation / Answer

The following is the required Bash Script :

The statements after REM are comments in batch. So please ignore them.

REM : To list the directories

dir

REM : Pausing the script

pause

REM : clearing the screen

cls

REM : pausing the screen again

pause

REM : For all the below commands
REM : /Create creates a task
REM : /D specifies day of the week of occurence
REM : /TN specifies task name
REM : /TR speccifies path to task
REM : /ST specifies task start time in a 24 hour format (HH : MM )
REM : /SC schedules frequency
REM : Scheduling the task Check Disk (disk.exe)


schtasks /Create /D FRI /TN TASK_NAME /TR path_to_disk.exe /ST 17:30

REM : In the above command TASK_NAME is the name of the task(your wish)
REM : and path_to_disk.exe is the path that directs the disk.exe file
REM : Suppose it is under users folder of C drive then the value is 'C:Usersdisk.exe'

REM : Scheduling the task Disk Defragmenter (dfrgui.exe)


schtasks /Create /SC MONTHLY /D 1 /TN TASK_NAME /TR path_to_dfrgui.exe /ST 23:30

REM : Displaying all the scheduled tasks

schtasks/query

REM : pausing the screen again

pause