Given:
I'm programing in C#, .NET 3.5, VS2005, WinXP pro SP3 (VS version & OS shouldn't matter)
Let's say that I've got more than one drive. (duh!) drives C: and D:
My current directory is: C:\SomeDirectoryOnDrvC\SomeSubdirectory
Question(s):
1) How do I find out what the current directory is on drive D: WITHOUT CHANGING THE CURRENT DRIVE to drive D:?
2) How do I change to drive D: preserving the current directory on that drive? (I know I can use the Directory class method .SetCurrentDirectory(@"D:") to change to a directory on drive D: (or any given drive). But it doesn't preserve what the current directory is currenty set to on that drive. No, I'm talking about something like the when you have a command window open and you enter "D:" It change you to drive D: to what ever the current directory is set to there. You can then do a "CD" comannd to change directories. If you then enter "C:", you're back to the current directory on drive C: If you then enter "D:", it changes you back to drive D: into what directory you just CD'd into?
Take the follow block of code
curDir =
the current directory is C:\Documents and Settings\PMBottas\My Documents\Visual Studio 2005\Projects\ChDrv\bin\Debugchanging to C:\Documents and Settings\PMBottasthe current directory on drive C: is C:\Documents and Settings\PMBottas
the current directory on drive D: is D:\changing to D:\Documents\All Lessonsthe current directory on drive D: is D:\Documents\All Lessons
changing back to C:the current directory on C: is C:\Program Files\Microsoft Visual Studio 8\Common7\IDEchanging back to D:the current directory on drive d: is D:\
What gives and why do I end up in the root when I switch back to D: and in C:\Program Files\Microsoft Visual Studio 8\Common7\IDE when I switch back to C:
Any help would be greatly appreciated
Thanks - Paul