June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to set the current working directory so you can use relative paths in your code.
Use the shared Directory.GetCurrentDirectory and Directory.SetCurrentDirectory methods.
Relative paths are automatically interpreted in relation to the current working directory. You can retrieve the current working directory by calling Directory.GetCurrentDirectory, or change it using Directory.SetCurrentDirectory. In addition, you can use the shared Path.GetFullPath method to convert a relative path into an absolute path using the current working directory.
Here’s a simple test that demonstrates these concepts:
Console.WriteLine("Using: " & Directory.GetCurrentDirectory()) Console.Write("The relative path ...Read now
Unlock full access