Friday, November 11, 2011

How to create a New folder using PowerShell.

 

Hi,

I know it is very simple to do :) , but sometime dumb like me don’t know how to do it . Or which Command is used to  do it ..

The Command which is used to create a new folder is : New-Item

You can also create a new folder using old mkdir command: Mkdir “Folder Name”

but let’s use PowerShell way to do this.

Lets Start:

Open PowerShell Console

To create a new Directory use this command  and hit enter:

New-Item -path D:\Demo -Name "Foo" -ItemType Directory

-path:  location path where you want to create folder

-Name : Name of the Folder / directory to be Created

-ItemType: it is “directory” to create a folder

and It creates a folder name “Foo” in D:\Demo

New-Item

what if you want to create a new folder which is already exists?

you will got an error “Directory Name Already exists”

New-Item-2

and If you want to create a new folder and that folder already exists and you want overwrite it, try      –Force switch parameter with the command.

New-Item-3

 

Hope this is helpful . . .

Thanks

Aman Dhally

2 comments:

  1. Its really helpfull....thanx

    ReplyDelete
    Replies
    1. Thanks..
      you are welcome Paritosh.

      thanks
      aman dhally

      Delete

Note: Only a member of this blog may post a comment.