Act 8 CPR

docx

School

Seneca College *

*We aren’t endorsed by this school

Course

101

Subject

Information Systems

Date

Dec 6, 2023

Type

docx

Pages

5

Uploaded by BarristerBoulder12701

Report
Name: Ishraq Anjum Naypunya Student ID: 168548220 Section: CPR101NFF Mail: ianaypunya@myseneca.ca Answers of Activity 8 1. The extension of the command prompt batch files is “.bat” or “.cmd”. There is no functional difference between these two, but historically “.bat” was used for batch files in the MS-DOS and early Windows operating systems. While “.cmh” is commonly used for more modern Windows batch scripts. They indicate that the file contains a series of command prompt commands and is intended to be executed as a batch script. Both extensions are still in use and we can create and run batch files with either extension. 2. The extension of the PowerShell script is “.ps1” file extension. PowerShell is a versatile scripting and automation framework developed by Microsoft and “.ps1” is the standard file extension for saving and running PowerShell scripts. To run a PowerShell script, we usually open a PowerShell command prompt or the PowerShell Integrated Scripting Environment (ISE) and use the appropriate command to run the script, such as .\script.ps1 if the script is in the current directory. 3. @echo off cd %userprofile%\Desktop :: Create 10 folders and 10 text files inside each folder for /l %%i in (1, 1, 10) do ( mkdir week%%i echo Ishraq Naypunya > week%%i\activity%%i.txt ) 4. @echo off cd %userprofile%\Desktop :: Move each activity file to its respective week folder
for /l %%i in (1, 1, 10) do ( move "activity%%i.txt" "week%%i" ) 5. # This PowerShell script creates 10 folders and 10 text files inside each folder on the desktop. $desktopPath = [System.Environment]::GetFolderPath('Desktop') # Create 10 folders and 10 text files inside each folder 1..10 | ForEach-Object { $folderName = "week$_" $folderPath = Join-Path -Path $desktopPath -ChildPath $folderName New-Item -ItemType Directory -Path $folderPath Set-Content -Path (Join-Path -Path $folderPath -ChildPath "activity$_.txt") –Value "Ishraq Naypunya" } 6. # This PowerShell script creates 10 folders (week1 to week10) on the desktop and generates text files (activity1.txt to activity10.txt) inside each folder. # Set the path to the desktop folder $desktopPath = [System.Environment]::GetFolderPath('Desktop') # Create 10 folders and 10 text files inside each folder 1..10 | ForEach-Object { $folderName = "week$_" $folderPath = Join-Path -Path $desktopPath -ChildPath $folderName New-Item -ItemType Directory -Path $folderPath $text = "Ishraq Naypunya" $text | Set-Content -Path (Join-Path -Path $folderPath -ChildPath "activity$_.txt") }
7. # This PowerShell script creates 10 folders (week1 to week10) on the desktop and generates text files (activity1.txt to activity10.txt) inside each folder using two for loops. # Set the path to the desktop folder $desktopPath = [System.Environment]::GetFolderPath('Desktop') # Create 10 folders 1..10 | ForEach-Object { $folderName = "week$_" $folderPath = Join-Path -Path $desktopPath -ChildPath $folderName New-Item -ItemType Directory -Path $folderPath } # Generate 10 text files inside each folder 1..10 | ForEach-Object { $folderName = "week$_" $folderPath = Join-Path -Path $desktopPath -ChildPath $folderName $text = "Ishraq Naypunya" $text | Set-Content -Path (Join-Path -Path $folderPath -ChildPath "activity$_.txt") } 8. # This PowerShell script creates 10 folders (week1 to week10) on the desktop and generates text files (activity1.txt to activity10.txt) inside each folder using a single for loop. # Set the path to the desktop folder $desktopPath = [System.Environment]::GetFolderPath('Desktop') # Create 10 folders and generate text files inside each folder using a single for loop 1..10 | ForEach-Object {
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
$folderName = "week$_" $folderPath = Join-Path -Path $desktopPath -ChildPath $folderName New-Item -ItemType Directory -Path $folderPath $text = "Ishraq Naypunya" $text | Set-Content -Path (Join-Path -Path $folderPath -ChildPath "activity$_.txt") } 9. # This PowerShell script creates 10 folders (week1 to week10) on the desktop and generates text files (activity1.txt to activity10.txt) inside each folder using cmdlets. # Set the path to the desktop folder $desktopPath = [System.Environment]::GetFolderPath('Desktop') # Create 10 folders using cmdlet New-Item 1..10 | ForEach-Object { $folderName = "week$_" $folderPath = Join-Path -Path $desktopPath -ChildPath $folderName New-Item -Path $folderPath -ItemType Directory } # Generate 10 text files inside each folder using cmdlet Set-Content 1..10 | ForEach-Object { $folderName = "week$_" $text = "Ishraq Naypunya" $textFilePath = Join-Path -Path $desktopPath -ChildPath $folderName -ChildPath "activity$_.txt" Set-Content -Path $textFilePath -Value $text -Encoding UTF8 }
10. # This PowerShell script creates 10 folders (week1 to week10) on the desktop and generates text files (activity1.txt to activity10.txt) inside each folder using cmdlets. # Set the path to the desktop folder $desktopPath = [System.Environment]::GetFolderPath('Desktop') # Create 10 folders using cmdlet New-Item 1..10 | ForEach-Object { $folderName = "week$_" $folderPath = Join-Path -Path $desktopPath -ChildPath $folderName New-Item -Path $folderPath -ItemType Directory } # Generate 10 text files inside each folder using cmdlet Set-Content 1..10 | ForEach-Object { $folderName = "week$_" $text = "Ishraq Naypunya" $textFilePath = Join-Path -Path $desktopPath -ChildPath $folderName -ChildPath "activity$_.txt" Set-Content -Path $textFilePath -Value $text -Encoding UTF8 }