Get path+filename of file that was opened with my application

后端 未结 3 2022
傲寒
傲寒 2020-12-11 09:41

I\'m an amateur at c# and I\'ve been unable to locate the answer to this. Perhaps I am not aware of the correct terms to use.

When a video file is dragged onto my ex

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-11 10:30

    You need your application's command-line arguments. When you drop a file on your application in Explorer, Explorer opens the application with the file you dropped on it. You can select as many files as you want, drop them on your application and using this line of code, files will be an array of those command line arguments.

    string[] files = Environment.GetCommandLineArgs();
    

提交回复
热议问题