Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating new file through Windows Powershell

I have googled for the below question, but could not find any answer. Can someone help me on this; What is the command to create a new file through Windows Powershell?

like image 872
JR Sahoo.'JS' Avatar asked Aug 01 '17 19:08

JR Sahoo.'JS'


People also ask

How do I create a .TXT file in PowerShell?

Use the echo Command to Create a New Text File Through Windows PowerShell. The echo command is a built-in alias for PowerShell's Write-Output cmdlet. It is similar to other shells that use echo . Both commands write the output to the pipeline and redirect the output to a new file.

How do I create and edit a file in PowerShell?

Ensure you open PowerShell as an administrator to install it. After the chocolatey package is installed, you can run this command to install the nano editor. You can use the nano editor on the PowerShell console to edit a text file. It will open the GNU nano editor to make changes to any text file.

How do I create a folder in PowerShell?

To create a folder in PowerShell, use the New-Item cmdlet indicating the location and name of the folder and set the itemType parameter with the value Directory to indicate that you want to create a folder.


1 Answers

I'm guessing you're trying to create a text file?

New-Item c:\scripts\new_file.txt -type file 

Where "C:\scripts\new_file.txt" is the fully qualified path including the file name and extension.

Taken from TechNet article

like image 78
J. D. Avatar answered Sep 23 '22 11:09

J. D.