by robotix1986
22. October 2009 12:24
To create a file programmatically we can use the below command: -
new-item -path c:\Test -name MyTestFile.txt -type "file" -value "This is a Test File with sample contents."
the above command creates a file "MyTestFile.txt" within the "C:\Test" directory with the given contents.
To create a folder, we can use the below command: -
new-item -path D:\MyAlreadyExistingFolder -name MyNewFolder -type directory
This command creates a folder named "MyNewFolder" within the "MyAlreadyExistingFolder" folder.
The essential thing to be noted in the above commands is the 'new-item' cmdlet. For more details and additional usage of this command visit this page.
Till my next post
Regards,
AlD
2e06ba70-1e1b-46fe-b4ed-bbb453111cfd|0|.0
Tags: powershell