I have downloaded the folder which contains many files from url and unzipped the folder. The folder will be downloaded by different people from the URL. I am opening the folder now every time different people open the folder the downloads path will be different from them. How to set dynamic downloads folder path.
Note: The file is getting downloaded to the " Downloads" folder in the local machine.
For unzip the file I have used “Environment.ExpandEnvironmentVariables(”%USERPROFILE%\Downloads")
The same thing is not working when I want to open the folder.
Usually what I do is when I am having same bot running in multiple VM / machine then I keep a folder path in config file. And that config file will be used while deploying in different machine. So that it has correct folder path required with respect to VM.
I am not sure if in your approach this will help or not. But you can have a config and store the relevant path there, so that while downloading the file it will store in provided path and same will be used to open it.
Hi use below code for accessing default download folder.
Path.GetDirectoryName(Environment.GetFolderPath(Environment.SpecialFolder.Personal)) + “\Downloads”
Hope it will work
Very helpful tip, I didn’t know this before. This will greatly help in upcoming projects. Thank you!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.