Search code examples
batch-fileaudiovbscriptinvisible

How to close an invisible VBS file


I am trying to code a batch file that can play a song. Luckily I found a solution to that at Stack Overflow. I used SachaDee's method, which created a VBS file that would play my mp3 file nicely.

My only issue is that once the VBS file is opened, I can't seem to find a way to stop the music. I even tried deleting the file in mid-song, but the song will still continue.

EDIT: I found out that the way to solve this is by running the following command.

taskkill /IM wscript.exe /F

Solution

  • Just to end up the question.


    taskkill /IM wscript.exe /F
    

    This will stop wscript.exe with full force. However, a vbs can also be executed through cscript.exe.

    According to this question, it seems to be ideal to use cscript for command-line, to execute VBS. Altough both works.