Dotnet fsi #cd and #silentcd

i notice fsi sometimes invoke these commands: #cd and #silentcd, but i not found description of them. Can you help me with it?

Although it’s not too hard to guess what they do (change directory), I could not find any documentation about it.
After searching the source code of FSI, I found the following code as part of a pattern match:

        | ParsedHashDirective("cd", ParsedHashDirectiveArguments [ path ], m) ->
            ChangeDirectory path m
            istate, Completed None

        | ParsedHashDirective("silentCd", ParsedHashDirectiveArguments [ path ], m) ->
            ChangeDirectory path m
            fsiConsolePrompt.SkipNext() (* "silent" directive *)
            istate, Completed None

Basically, both directives are used to change the current directory you are in.
For example, if you launched the FSI session in your home directory, and you run #cd "Documents", you will switch to the Documents directory.

1 Like