I wrote a script which is doing net use at the beginning and net use /DELETE at the end.
But if user decides to press Ctrl +
There is a very simple solution. Just write:
ping -l www."site".com -t 65500>nul
before your net use /delete command. The only way to break that command is to press ctrl+c. By example:
net use "arguments"
ping -l www.google.com -t 65500>nul
net use /delete
This is a good way to detect ctrl+c, but beware of the site address you write, because it risks to make that site crash. You should, by consequence, write the address of an unusual site, or of a site of your own(Attention: the site must be existing), like a blog or something like that.