Hello I'm new here I need a script to check, if a folder exist and then run a file from the folder. If not, it should extract a ZIP file into a specific location. Thanks in advance!
You can use WScript. ScriptFullName which will return the full path of the executing script.
Step 1: Press Ctrl + Shift + S on the keyboard, Or click File>Save As on the notepad window, this will open up a Save As dialog window asking where to save the current notepad document. Step 2: Now write any file name of your choice for this notepad document but make sure you write . vbs as its extension.
VBScript ("Microsoft Visual Basic Scripting Edition") is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It allows Microsoft Windows system administrators to generate powerful tools for managing computers with error handling, subroutines, and other advanced programming constructs.
'Objects
Set fso = CreateObject("Scripting.FileSystemObject")
Set shl = CreateObject("WScript.Shell")
path="C:\SomeFolderToExist\" 'path to folder
exists = fso.FolderExists(path)
if (exists) then
program="myprog.exe" 'Program name to run
shl.Run(path & program) 'Run a program
end if
For unzipping, I can only tell you to see this: Extract files from ZIP file with VBScript
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With