Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8766749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:37:46+00:00 2026-06-13T16:37:46+00:00

I never did any vbscript before, so i don’t know if my question is

  • 0

I never did any vbscript before, so i don’t know if my question is very easy one. Following is the flow of steps that has to be done :

Check if exist and delete a folder at c:\test1 if found and continue. If not found continue.
Check if exist and delete a folder at c:\programfiles\test2 if found and continue. If not found continue.
Check if a desktop shortcut and start menu shortcut exist and delete if found. If not exit.

I could delete 2 folders with the following code:

strPath1 = "C:\test1"
strPath1 = "C:\test1"
DeleteFolder strPath1
DeleteFolder strPath1
Function DeleteFolder(strFolderPath1)
Dim objFSO, objFolder
Set objFSO = CreateObject ("Scripting.FileSystemObject")
If objFSO.FolderExists(strFolderPath) Then
    objFSO.DeleteFolder strFolderPath, True
End If
Set objFSO = Nothing

But i need to run one script to delete 2 folders in different paths, 2 shortcuts one in start menu and one on desktop.

I was experimenting with this code to delete the shortcut on my desktop:

Dim WSHShell, DesktopPath
   Set WSHShell = WScript.CreateObject("WScript.Shell")
   DesktopPath = WSHShell.SpecialFolders("Desktop")
   on error resume next
   Icon = DesktopPath & "\sample.txt"
   Set fs = CreateObject("Scripting.FileSystemObject")
   Set A = fs.GetFile(Icon)
   A.Delete
   WScript.Quit

It works fine for txt file on desktop, but how do i delete a shortcut for an application from desktop as well as start menu.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:37:47+00:00Added an answer on June 13, 2026 at 4:37 pm
    strPath1 = "C:\test1"
    strPath2 = "C:\test2"
    
    DeleteFolder strPath1
    DeleteFolder strPath2
    
    DeleteShortcut
    
    '-------------------------------------------------------
    Sub DeleteFolder(strFolderPath)
      Set fso = CreateObject ("Scripting.FileSystemObject")
      If fso.FolderExists(strFolderPath) Then
        fso.DeleteFolder strFolderPath, True
      End If
    End Sub
    
    '-------------------------------------------------------    
    Sub DeleteShortcut()
      Set WSHShell = WScript.CreateObject("WScript.Shell")
      DesktopPath = WSHShell.SpecialFolders("Desktop")
    
      shortcutPath = DesktopPath & "\MyShortcut.lnk"
      Set fso = CreateObject("Scripting.FileSystemObject")
      If fso.FileExists(shortcutPath) Then
        Set myFile = fso.GetFile(shortcutPath)
        myFile.Delete
      End If
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I never did any serious Java coding before, but I learned the syntax, libraries,
I have to create a fb application, I never did one before but I
Never ran into this problem with jQuery before. I have the following: $(document).ready(function() {
Never did XSLT before. Is that possible to inherit a doc and replace just
Which family should I start to learn? (Never did any programming on microcontroller)
Never did any kind of embedded or hardware programming, I mainly deal with web
what do you prefer for testing JavaScript apps using Cucumber? I never did it
I did a little bit of Web Programming here and there but I never
Never thought I'd have this problem :) The following snippet of code works in
Having never used awk before on Linux I am attempting to understand how it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.