Create a new. Erlang File:
Io:format ("consulting. Erlang in ~p~n", [Element (2, FILE:GET_CWD ())]).
C:CD ("C:/erl5.7.2/work"). % Note is the symbol "/" instead of "\". The catalogue changes according to individual needs
Io:format ("Now in:~p~n", [Element (2, FILE:GET_CWD ())]).
To view the properties of the Erlang executable program:
For example, my environment:
Erlang Shell Path: C:\erl5.10.2\bin\werl.exe
Its actual use directory: C:\ERL5.10.2\USR (default starting directory)
Place the created. Erlang file in the default start directory C:\erl5.10.2\usr.
This will automatically switch the current directory to C:\erl5.10.2\work each time it is started
Add two points:
1. You need to ensure that the new working directory does exist, otherwise viewing the environment using the PWD () command is still the default.
2. If you enter C:\erl5.10.2\bin\ to run the Werl.exe file, the environment that is viewed with the PWD () command is C:/erl5.10.2/bin, when the. Erlang file is placed in the corresponding directory.
Under command line:
1> CD ("c:/"). % Setting Directory
2> pwd (). % View current directory
Modify Erlang default path under Windows system