Showing posts with label new-item. Show all posts
Showing posts with label new-item. Show all posts

Sunday, January 18, 2009

create a registry key under HKLM

to create a registry key named '_Test' in the CurrentVersion subkey

PS> New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\_Test


Hive: Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion

SKC VC Name Property
--- -- ---- --------
0 0 _Test {}

create a directory and file

[] to create a new directory named 'new.directory' in the 'r:\temp' directory

PS> new-item -path r:\temp\new.directory -itemtype directory

[] to create a file named 'file1.log' in the 'r:\temp' directory

PS> new-item -path r:\temp\file1.log -itemtype file


Directory: Microsoft.PowerShell.Core\FileSystem::R:\temp


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2008-Dec-10 7:39 PM 0 file1.log <--- empty content