Solved

VBS Script DOES NOT EXIST

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

816 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

10 Experts available now in Live!

Get 1:1 Help Now