I'd like to be able to let users drag and drop files onto my console app's window so they are not forced to drag'n'drop files onto the app's icon (or link, or even worse write a command line in console). How do I get the list of paths of files I drop onto my app's window?
ReadLine() will keep the window open until enter is pressed, but Console. ReadLine() will only be called if the debugger is attached.
If it's a framework-dependent application (the default), you run it by dotnet yourapp. dll . If it's a self-contained application, you run it using yourapp.exe on Windows and ./yourapp on Unix.
You can just listen for the keyboard. When dragging a file onto a console window the window gets keyboard events as if the file name was entered directly.
That's how you can drop a file on a cmd
or PowerShell window and get the full file name as if entered directly and it works the same for your own applications too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With