Link to home
Start Free TrialLog in
Avatar of mishcondereya
mishcondereyaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VBS Script DOES NOT EXIST

Hello

I've got a bit of script that basically says, if this file exists then exit the script. What amendment would I have to make to the below script so it says if the file DOESN'T exist then exit?

Thanks in advance.
If oFSO.FileExists(sProfilePath & "\" & sUserName & "\ntuser.dat") Then
'   WScript.Echo "Roaming profile exists..."
   WScript.Quit(0)
End If

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
sirBounty is right
Here is an example to respond to either case


zf
set oFSO = CreateObject("Scripting.FileSystemObject")
If  oFSO.FileExists(sProfilePath & "\" & sUserName & "\ntuser.dat") = True Then
	MsgBox "File Found"
Else
	MsgBox "File Not Found"
End If

Open in new window