I was doing some testing which incorporated a couple of environment variables. I used SETX to create those variables in the user's context to be picked up by other applications. When done testing, I wanted to get rid of them using SETX. Now there doesn't seem to be a way do delete environment variab...
As you discovered, the Windows SMD Shell isn't exactly suited for this kind of jobs. You may want to look into something like Autohotkey https://www.autohotkey.com/?
Not sure I get the problem, but when I try it, it works ok - it opens Explorer and selects the specified file. If the file specified doesn't exist, you'll indeed open Explorer in 'This PC'. So either make sure the file is there or specify a path only?
The part that fails is this: set Pattern=%Name% set Archive=%Name% If you add quotes, the problem is solved: set Pattern="%Name%" set Archive="%Name%" But it's weird - if you execute the script line by line (copy / paste) in the command window, it won't throw an error. And I wond...
I've setup a task in Task Scheduler to act upon a series of events triggered by Windows Defender. When triggered, it executes a script to send me an e-mail that there's something going on with Defender. Works fine. Now I want the e-mail to be a bit more informative, like what is the event and what i...