How to save .env file in windows?

If you use Windows, to save any file with an extension different from the default extension of the tool you are using, You have to select the option which appears like:

All Files or All Files (*.*) in the Type of File dropdown in the save dialogs.


Follow the steps below:

  1. Open Notepad or Notepad++ and write the context in the file. Notepad workspace screen with some context

  2. Goto FILE-> SAVE AS Save as Screen in the notepad

  3. Select the All files()All files selection

  4. Save the file with .env in the end.env extension

  5. You've created .env file.env file

I've tried to create .env file in VS Code but it didn't work somehow. If you've any idea please let me know.


In windows normally you can not create a file without name. So to create a .env file there are three ways I know...

  1. Copy paste from somewhere else
  2. If you have installed php then run this command in console php -r "copy('anyfile.example', '.env');"
  3. Create a txt file called anything.txt open CMD and find its dir then run ren anything.txt .env

Open your xx.env file with notepad++ and file -> saveas -> rename to .env and save