Solved

VBS Script DOES NOT EXIST

Posted on 2009-05-05
3
329 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

627 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