Please Help!!! Question 1 - 4 You work in a small office where 10 users with Win
ID: 3671167 • Letter: P
Question
Please Help!!! Question 1 - 4
You work in a small office where 10 users with Windows 7 computers need to have the same directory structure. Each computer must have a customer directory and a sales directory in the user's Documents directory. Further, the customer directory must contain directories named whlsale and retail. The sales directory must contain three directories: ads, promos, and plans. Therefore, you have decided to automate this task. To automate the process of creating several directories on 10 computers, create a batch file similar to the listing that follows, and name the batch file with a name, such as newdirs.cmd. You can distribute this batch file to each user via email, with instructions for copying the file onto their Desktop and running it from there in the GUI. ECHO OFF ECHO This batch file will create subdirectories in the Documents directory. PAUSE Test the batch file by clicking on it from the GUI or by opening a Command Prompt, changing to the location of the batch file and enter the name in the Command Prompt. The output from this command should look like this: This batch file will create subdirectories in the Documents directory. Press any key to continue... The directories have been created. Press any key to continue... Did the batch file run correctly for you? If not, open it again in Notepad and look for typos. Then run it again. After you have succeeded in running the batch file, explain what each line of the file is doing. If you do not understand how a command line works, research it using the help file, Internet searches, and any other sources. Then insert a comment line above each line of the batch file, explaining what each command does. Create a comment line by beginning the line with the colon (:). A comment is not executed, and if echo is turned off, it will not display during the execution of the batch file.Explanation / Answer
Even though the instructions mentioned available in setp 1 will create directories and sub-directories but giving some error as shown below
This Batch File will create Subdirectories in the documents directory
Press any key to continue . . .
A subdirectory or file customers already exists.
Error occurred while processing: customers.
A subdirectory or file customerswhlsale already exists.
A subdirectory or file customer already exists.
Error occurred while processing: customer.
A subdirectory or file sales already exists.
Error occurred while processing: sales.
A subdirectory or file promos already exists.
Error occurred while processing: promos.
The Directories have been created
Press any key to continue . . .
Hence modified little bit and provided comments starting with ( :) as required in question 4 ,as shown below and it works as required .
To know about %homepath% ... can type the following on command prompt
echo %homepath%
*******************************************************************************************************************
@ECHO OFF
ECHO This Batch File will create Subdirectories in the documents directory
PAUSE
:change directory to %homepathdocuments
cd %homepath%documents
:make directory customers and Sales
md customers sales
:change directory to customers
cd customers
:make directories whlsale and retail(sub-dir) under customers
md whlsale retail
:change directory to sales
cd ..sales
:create directories ads promos plans(sub-dirs) under sales
md ads promos plans
ECHO The Directories have been created
PAUSE
**************************************************************************************************************************
Hope this is what you are looking for ?