How to save .env file in windows?
Asked Answered
O

7

11

I tried to save file with .env file extension but I could not see any .env file extension in save as dropdown option.

I also tried to rename it as .env but it gets saved as text file (see screenshot) how can I fix this issue ?

enter image description here

Obeng answered 13/2, 2018 at 15:51 Comment(6)
use a text editor to save .smthing files. Like notepad++ or vscode.Jamaaljamaica
@Jamaaljamaica I am not able to save it I am using sublime text.Obeng
that makes no sense, Sublime should be able to save it just fine...Jamaaljamaica
in the dropdown, select All FilesSymbolic
@AyushGupta Similarly if I want to save auth0-config.js.example so .example file should be saved with same procedure am I right ?Obeng
if you want to give the extension manually, use All FilesSymbolic
S
21

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.

Symbolic answered 13/2, 2018 at 16:25 Comment(2)
open the file in notepad , when saving, filename extension .env - choose Save as Type: All Files ( * . * ) from dropdown.Hanzelin
windows didn't support .env file like this. just use editors like vs code online or offline app to create easlyEnto
M
9

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

Mauriciomaurie answered 30/9, 2019 at 17:16 Comment(0)
E
5

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
Evacuee answered 25/3, 2019 at 6:51 Comment(0)
H
2

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.

Hollister answered 7/6, 2021 at 6:47 Comment(0)
C
2

Steps to create .env file in Windows machine:

  1. Open a Notepad and write the credentials inside the file
  2. Click on Save option and change the file type to 'All files'
  3. Keep the file name as .env
  4. Hit Save Now the file is an .env file. You can also check the file type in File Explorer to confirm.
    One thing to remember is to put the file inside your Project directory where your code which accesses this .env file is stored.
Caban answered 9/12, 2021 at 9:0 Comment(0)
R
-1

You can create a .env file in an IDE directly, like Visual Studio Code.

1.) Just right-click on the directory and create a new file.

2.) Name it as .env

Resolvable answered 9/10, 2020 at 21:57 Comment(0)
B
-2
  1. You can open notepad
  2. Type the information
  3. go to file
  4. click on save
  5. change the file type to (.)
Boyle answered 15/8, 2022 at 17:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.