Hey, could anyone give me a hand with a bit of vbs? I'm stuck with some of the logic, and haven't played with vbs is a long time. I'm trying to create a script that will do the following:
1- Check if text file exists, if so, quit.
2- If not, create text file. (So, script doesn't run next time) Then...
3- Check if directiory exists, if so, delete.
4- Run installer
5- End.
However, I'm running into some issues putting it all together, can you help? It's something like this, obviously still not correct.
Thanks
1- Check if text file exists, if so, quit.
2- If not, create text file. (So, script doesn't run next time) Then...
3- Check if directiory exists, if so, delete.
4- Run installer
5- End.
However, I'm running into some issues putting it all together, can you help? It's something like this, obviously still not correct.
Code:
On Error Resume Next
dim filetxt, getname, path
Set fso = CreateObject("Scripting.FileSystemObject")
If NOT (fso.FileExists("C:\OK.txt")) Then
Set filetxt = filesys.CreateTextFile("C:\OK.txt", True)
path = fso.GetAbsolutePathName("C:\OK.txt")
getname = fso.GetFileName(path)
filetxt.WriteLine("Script ran succesfully")
filetxt.Close
End If
NEXT
If fso.FolderExists("C:\Program Files\Application") = True Then
fso.DeleteFolder("C:\Program Files\Application")
End If
oShell.run "C:\Setup.exe -q", 1, true
End If
Thanks