Collections:
Other Resources:
Create Directory in Windows PowerShell
How to create a directory in Windows PowerShell? Can I use the old "mkdir" command?
✍: FYIcenter.com
Yes, you can still use the old "mkdir" command in Windows PowerShell. But "mkdir" is defined as an alias of the "New-Item" cmdlet.
The "New-Item" cmdlet creates a new directory or file. The "New-Item" cmdlet requires 2 minimum parameters:
After the new item is created, "New-Item" cmdlet returns the new item as an object. The example below creates a new directory under the current directory:
PS C:\fyicenter> New-Item -Type Directory logs Directory: C:\fyicenter Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 5/1/2016 7:11 PM logs
Note that "mkdir" is defined as alias of "New-Item -Type Directory". So the following 2 commands are identical::
mkdir docs New-Item -Type Directory docs
You can also use "New-Item" for create a new file with content as shown below:
PS C:\fyicenter> New-Item logs\today.log -Type File -Value "- Server started" Directory: C:\fyicenter\logs Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 5/1/2016 7:12 PM 16 today.log
⇒ Rename Directory or File in Windows PowerShell
⇐ Get Directory Entries in Windows PowerShell
2016-10-24, 9946🔥, 0💬
Popular Posts:
How to remove realsched.exe from the startup application list to gain performance and reduce securit...
What is HPQTOA~1.EXE or HPQToaster.exe - Process - HpqToaster Module? Process HPQTOA~1.EXE or HPQToa...
What is pdf.ocx - ActiveX - Adobe Acrobat Control Version 6.0 for ActiveX? ActiveX pdf.ocx is instal...
What is the installed program "Windows SDK AddOn" on my Windows 7 computer? "Windows SDK AddOn" is a...
Where are registry keys located for Installed Programs and programs on my Window 7 system? When a so...