Creating Multiple Folders: Step-by-Step Exercises

In this exercise, we explore the use of constants, variables, concatenation, decision making, and looping as we create 10 folders in the C:\Mytest directory. This directory was created earlier. If you do not have this folder on your machine, you can either create it manually or modify both the step-by-step exercise and the one step further exercise to use a folder that exists on your machine.

  1. Open Notepad or your favorite Windows PowerShell script editor.

  2. Create a variable called $intFolders and have it hold the value of 10. The code to do this is shown here:

    $intFolders = 10
  3. Create a variable called $intPad. Do not put anything in the variable yet. This code is shown here:

    $intPad
  4. Create a variable ...

Get Microsoft® Windows PowerShell™ Step By Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.