Solved

VBS Script DOES NOT EXIST

Posted on 2009-05-05
3
303 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

867 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

22 Experts available now in Live!

Get 1:1 Help Now