I'm trying to create a Windows console application which simply opens a folder picker dialog box trough which the user can select a folder. The application would then change current working directory of the command prompt to the path of the selected folder.
This is the entirety of the application, it's only purpose is to allow me to easily change the current working directory of a command prompt by simply typing the name of the executable and selecting the desired folder (provided that the directory where the executable is stored is listed in the PATH
environment variable).
I know about the existence of the FolderBrowserDialog
class and the CFolderPickerDialog
class in MFC, but I'd just like it to look and function as close as possible to the OpenFileDialog
class (and MFC doens't seem like much of an option since it is a console app).
Never mind the fact that an application can only change it's own current folder, this is another issue on it's own and it is not related to this question. A work arround for this issue is described here.
What would the easiest way to achieve such behavior be?