Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VBS Script DOES NOT EXIST

Posted on 2009-05-05
3
Medium Priority
?
333 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 1000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

715 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