开发者

What happens when a path has no directory separator?

开发者 https://www.devze.com 2023-01-18 13:50 出处:网络
C:WPro开发者_如何学Cgram Files Anyone knows such kind of location? How is it processed in programmes, the same as \\ ?A path with a drive letter and then a relative path is resolved relative to the
C:WPro开发者_如何学Cgram Files

Anyone knows such kind of location? How is it processed in programmes, the same as \ ?


A path with a drive letter and then a relative path is resolved relative to the current directory for that drive letter.

Windows and MS-DOS systems keep track of the current directory for each drive letter separately.

For example:

G:\>dir c:
 Volume in drive C is System
 Volume Serial Number is A09A-AD9C

 Directory of C:\

06/12/2008  02:44 PM                 0 AUTOEXEC.BAT
06/12/2008  02:44 PM                 0 CONFIG.SYS
08/25/2008  02:22 PM    <DIR>          Documents and Settings
12/09/2009  12:45 PM    <DIR>          Program Files
[snip]

G:\>cd "c:\Program Files"

G:\>dir c:
 Volume in drive C is System
 Volume Serial Number is A09A-AD9C

 Directory of C:\Program Files

12/09/2009  12:45 PM    <DIR>          .
12/09/2009  12:45 PM    <DIR>          ..
05/14/2010  11:38 AM    <DIR>          7-Zip
12/13/2010  01:49 AM    <DIR>          Adobe
[snip]

G:\>dir c:Adobe
 Volume in drive C is System
 Volume Serial Number is A09A-AD9C

 Directory of C:\Program Files\Adobe

12/13/2010  01:49 AM    <DIR>          .
12/13/2010  01:49 AM    <DIR>          ..
01/25/2010  01:45 AM    <DIR>          Reader 8.0
12/13/2010  01:49 AM    <DIR>          Reader 9.0

The path c:Adobe became the same as C:\Program Files\Adobe because that was the current directory for the C drive, even though the current drive was actually the G drive.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号