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 parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see Directory.GetCurrentDirectory.
Trailing spaces are removed from the end of the path parameter before setting the directory.
The path parameter is not case-sensitive.
If you are setting the directory to a drive with removable media (for example, to "A:" for a floppy disk drive or "E:" for a CD-ROM drive), you can determine whether the drive is ready by using the DriveInfo.IsReady property.