VBS Script help

Posted on 2006-04-07
Last Modified: 2010-04-17
Hi can anyone help me with a VBS script that will delete *.VBS from the same directory that the script is in

So if i run Script.vbs it will delete itself and another VBS script in the same directory!
Question by:bryanchellen
    LVL 44

    Expert Comment

    Hello bryanchellen,

    that sounds like it could be used for malicious purposes, deleting itself after running
    do you have a logical reason for this kind of script?

    LVL 85

    Accepted Solution

    Could just be a cleaning utitlity...

    Dim fso, folder, file, fileCollection
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set folder = fso.GetFolder(".")
    Set fileCollection = folder.Files
    For Each file In fileCollection
        If UCase(Right(file.Name, 4)) = ".VBS" Then
            fso.DeleteFile file.Name, True
        End If
    LVL 44

    Expert Comment

    yes could be

    Author Comment

    I think your a bit crazy bruinjte????


    Author Comment

    cheers idle man!
    LVL 44

    Expert Comment

    yes, that could well be my sincere apologies

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Title # Comments Views Activity
    java ^ examples 8 48
    wefewf 2 28
    sumHeights2  challenge 7 50
    How to get boolean result of md5sum from two files in powershell 8 44
    This article is filled with multiple code samples and explanations for mathematical calculations. They are as follows: 1. General tips 2. Quadratic formula 3. Object collision 4. Projectile path General Tips       Here are some of my tips f…
    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now