Create a PowerShell script that performs the same functions as the Lab3.bat that you used in Lab 3 with minor changes: · The Parent directory created should be CST2107Lab4 (instead of CST2107Lab3) ·...

1 answer below »
file attached


Create a PowerShell script that performs the same functions as the Lab3.bat that you used in Lab 3 with minor changes: · The Parent directory created should be CST2107Lab4 (instead of CST2107Lab3) · The directory must be created RELATIVE where the user runs the script. (Do not use C:\CST2107Lab4 which is an absolute reference.) · Make sure to include a command to remove the CST2107La4 directory structure including all sub folders and files if it already exists. Note:  Do not use ALIAS commands for the script. Below is the .bat file @echo off if exist C:\CST2107Lab3 ( RD /S /Q "C:\CST2107Lab3") md C:\CST2107Lab3 cd C:\CST2107Lab3 for /l %%a in (1,1,5) do ( md Course%%a cd Course%%a for /l %%b in (1,1,10) do ( md Lab%%b cd Lab%%b for /l %%c in (1,1,12) DO echo.test> %username%-Course%%a-Lab%%b-File%%c.txt cd..) cd..) echo "Script is complete - please complete your Lab activities."
Answered 1 days AfterOct 27, 2021

Answer To: Create a PowerShell script that performs the same functions as the Lab3.bat that you used in Lab 3...

Ketaki answered on Oct 28 2021
124 Votes
$intF1 = 5
$intF2 = 10
$intF3 = 12
$i = 1
$j = 1
$k = 1
$a = 'a'
$b = 'b'
$c = 'c'
New-Vari
able -Name strPrefix1 -Value "Course" -Option constant
do
{
    if ($i -lt 6)
    {
        new-item -path C:\CST2107Lab4 -name $strPrefix1$i$a -type directory
    }
    $i++
}until ($i -eq $intF1+1)
New-Variable -Name strPrefix2 -Value "Lab" -Option constant
do
{
    if ($j -lt 11)
    {
        new-item -path C:\CST2107Lab4\Course1a -name $strPrefix2$j$b -type directory
        new-item -path C:\CST2107Lab4\Course2a -name $strPrefix2$j$b -type...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here