Path.combine for dynamic path

I want to create a dynamic path so it can run on any system.
I am using Path.combine but it’s not working.

Path1=“C:\User\Admin\Desktop\abc_folder”

here is my example : a= Directory.GetFiles((Path.Combine(Path1)),“.”)

how to create a path for desktop that can be run on any system

Hi @Aarti_Godhasara1,

You can try this code: Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

DynamicDesktopFolderPath.xaml (3.9 KB)

For Reference: windows - How to get a path to the desktop for current user in C#? - Stack Overflow

Thanks!

1 Like