Hi
I need a vb script to delete a shourtcut inside the alluser profile startmenu
%ALLUSERSPROFILE%\STARTMENU\PROGRAMS\AAA\BBB\XYZ.URL

THIS IS WHAT THE SAMPLE PATH FOR THE SHORT,

Please any one give me the script

Thanks in advance
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
I'm I missing something?....

Isn't this just:
del "%ALLUSERSPROFILE%\START MENU\PROGRAMS\AAA\BBB\XYZ.URL"

Save as a bat, and call it a day?
Answered 02/22/2011 by: dchristian
Red Belt

Please log in to comment
0
In case your calling the .bat from inside a CA it's not that pretty to see a command prompt pop-up for a second.
I would go for the vbs in the above scenario:


set oWsh = CreateObject("WScript.Shell")
set oFSO = CreateObject("Scripting.FileSystemObject")
shortcut = oWsh.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Start Menu\Programs\AAA\BBB\XYZ.URL"

if oFSO.FileExists(shortcut) then
oFSO.DeleteFile(shortcut)
End If
Answered 02/23/2011 by: package_aligator
Orange Belt

Please log in to comment
0
oWsh.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")

Ugh, why do you script guys still do this? The Common Programs folder is a known/"special" folder to vbscript. You should write your code to work with all modern versions of Windows, not just XP.

This might be a little dated now, but it's better than reading that environment variable:
http://msdn.microsoft.com/en-us/library/0ea7b5xe(v=vs.85).aspx
http://www.aspfree.com/c/a/Windows-Scripting/Writing-Portable-Scripts-in-WSH/3/
Answered 03/17/2011 by: mazessj
Blue Belt

Please log in to comment
0
why do you script guys still do thisFor the same reason why scripts contain ZERO error-trapping: ignorance.
Answered 03/18/2011 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity