Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » New-Item

New-Item - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

New-Item

Description
Create a new item in a namespace

Usage


Options


Example(s)
Create a text file:

PS C:\>new-item -path C:\docs -name SS64.txt -type "file" -value "some text"

Create a directory named 'Demo Folder' in the C: drive:

PS C:\>new-item -path c:\ -name "Demo Folder" -type directory

Create a PowerShell profile in the path specified by the $profile variable:

PS C:\>new-item -path $profile -type file -force

$profile is an automatic (built-in) variable that stores the path and file name of your PowerShell profile (a profile is a text file). To see the value of the $profile variable, type "$profile"

By default, the profile does not exist, even though PowerShell stores a path and file name for it.

After you use the command above to create a profile, you can enter aliases, functions, and scripts in the profile to customize your shell.