Solved

VBS Script DOES NOT EXIST

Posted on 2009-05-05
3
290 Views
Last Modified: 2012-05-06
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

0
Comment
Question by:mishcondereya
3 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 250 total points
ID: 24306409
place a NOT between If and oFSO

If Not oFSO.FileExists...
0
 
LVL 6

Expert Comment

by:Mark Pavlak
ID: 24306705
sirBounty is right
0
 
LVL 12

Expert Comment

by:zoofan
ID: 24306838
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

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

19 Experts available now in Live!

Get 1:1 Help Now