Sets the application's current working directory to the specified directory.
- path
- A string containing the path to which the current working directory is set.
Type Reason ArgumentException path is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. ArgumentNullException path is null. System.IO.FileNotFoundException path was not found. System.IO.IOException An I/O error occurred while performing the operation. System.IO.PathTooLongException The length of path or the absolute path information for path exceeds the system-defined maximum length. System.Security.SecurityException The caller does not have the required permission to access unmanaged code.
When the application terminates, the working directory is restored to its original location (the directory where the process was started).
The path argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory.
Note: To obtain the current working directory, see Directory.GetCurrentDirectory.On platforms that do not support this feature, this method has no effect.
Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0