开发者

Access parent drive "relatively" on Windows

Is there any "built-in" way to a开发者_开发问答ccess the parent drive "relatively" on Windows?

i.e, instead of my program storing a path like K:\1\2\3 (K:\ being a USB flash drive), I'd like it to store the path without the drive letter, that way if the drive letter happens to change in the future, the stored path will still be valid because it's dynamic.

I know I can manually replace the drive letter with something like Flash:\ before storing the path, and then before accessing the stored path, replace Flash:\ with the letter of the drive that my program is currently running on, but I wanted to know if there was a "built-in" way to do this, where I could just pass a certain string to Windows in place of the drive letter and Windows would automatically replace it with the drive letter that the current program is running on.


Try just using \1\2\3\

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜