Windows path with no slash after drive letter and colon - what does it point to?

后端 未结 4 1378
悲&欢浪女
悲&欢浪女 2021-02-08 20:34

I have mistyped a path and instead of c:\\foo.txt wrote c:foo.txt. I expected it to either fail or to resolve to c:\\foo.txt, but instead

4条回答
  •  鱼传尺愫
    2021-02-08 21:16

    It uses the current working directory on that drive. Each process "remembers" a current working directory per drive:

     C:\> cd somepath\subdir
     C:\somepath\subdir>  d:
     D:\> dir c:subsubdir       <--  refers to C:\somepath\subdir\subsubdir
    

提交回复
热议问题