Directory.SetCurrentDirectory Method
Click or drag to resize
DirectorySetCurrentDirectory Method
Sets the application's current working directory to the specified directory.

Namespace: Alphaleonis.Win32.Filesystem
Assembly: AlphaFS (in AlphaFS.dll) Version: 2.0
Syntax
public static void SetCurrentDirectory(
	string path
)

Parameters

path
Type: SystemString
The path to which the current working directory is set.
Remarks

MSDN: Multithreaded applications and shared library code should not use the SetCurrentDirectory function and

should avoid using relative path names. The current directory state written by the SetCurrentDirectory function is stored as a global variable in each process,

therefore multithreaded applications cannot reliably use this value without possible data corruption from other threads that may also be reading or setting this value.

This limitation also applies to the GetCurrentDirectory and GetFullPathName functions. The exception being when the application is guaranteed to be running in a single thread,

for example parsing file names from the command line argument string in the main thread prior to creating any additional threads.

Using relative path names in multithreaded applications or shared library code can yield unpredictable results and is not supported.

See Also