Note that such a path can include relative directory segments (. You can determine whether a file path is fully qualified (that is, if the path is independent of the current directory and does not change when the current directory changes) by calling the Path.IsPathFullyQualified method. Use of the second form when the first is intended is a common source of bugs that involve Windows file paths. As result, the first is an absolute path from the root directory of drive C:, whereas the second is a relative path from the current directory of drive C. Both specify the optional volume specifier ( C: in both cases), but the first begins with the root of the specified volume, whereas the second does not. Note the difference between the last two paths. \Program Files\Custom Utilities\StringFinder.exeĪ relative path from the root of the current drive.Ī relative path to a file in a subdirectory of the current directory.Ī relative path to a file in a directory starting from the current directory.Īn absolute path to a file from the root of drive C.Ī relative path from the current directory of the C: drive. PathĪn absolute file path from the root of drive C. The following table shows some possible directory and file paths. Otherwise, the path is relative to the current directory. If no volume or drive letter is specified and the directory name begins with the directory separator character, the path is relative from the root of the current drive. If all three components are present, the path is absolute. ![]() The directory separator character separates the file path and the filename. The directory separator character separates subdirectories within the nested directory hierarchy. A volume or drive letter followed by the volume separator ( :).Traditional DOS pathsĪ standard DOS path can consist of three components: This topic discusses the formats for file paths that you can use on Windows systems. This path is then passed to Windows file system APIs. Members of many of the types in the System.IO namespace include a path parameter that lets you specify an absolute or relative path to a file system resource.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |