02/24/2018 739 views
I have a batch file setup to delete our old VPN software and install our new VPN software and add a new shortcut.  Everything is working great within the batch file besides deleting the old shortcut from the desktop in MI.  Is there a trick to get this to work in MI?  If I run in cmd it works just not within my batch in MI. 

del "%userprofile%\Desktop\VPN Client.lnk"

0 Comments   [ + ] Show comments


All Answers

This is because you MI is started in system context and %userprofile% is resolved to C:\Windows\System32\config\systemprofile\

Fortunately DEL command allows to use a wildcard, so you can remove the shortcut from each user's profile with just one command:

DEL "C:\USERS\*VPN Client.lnk" /S /F /Q
Answered 02/25/2018 by: rad33k
Third Degree Brown Belt