Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

VB Script Help

Thread Tools
 
Search this Thread
 
Old 19 September 2003, 02:45 PM
  #1  
Davie
Scooby Regular
Thread Starter
 
Davie's Avatar
 
Join Date: Sep 2002
Posts: 530
Likes: 0
Received 0 Likes on 0 Posts
Post

Hello all.

I need some help with some VB.

Basically i need the code to check if a file exists, and if that file exists, run a batch file, if not, goto end.

Any help would be appreciated!
Old 19 September 2003, 03:09 PM
  #2  
JackClark
Scooby Senior
 
JackClark's Avatar
 
Join Date: Dec 2000
Location: Overdosed on LCD
Posts: 20,852
Received 51 Likes on 34 Posts
Post

Can't you just add the check to the beginning of the batch file?
Old 19 September 2003, 03:17 PM
  #3  
JackClark
Scooby Senior
 
JackClark's Avatar
 
Join Date: Dec 2000
Location: Overdosed on LCD
Posts: 20,852
Received 51 Likes on 34 Posts
Post

echo off
IF EXIST C:\scooby.doc GOTO Scooby
Goto end
:Scooby
ECHO Scooby
:end
Old 19 September 2003, 04:20 PM
  #4  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists("C:\FSO\ScriptLog.txt") Then
Set WshShell = WScript.CreateObject("WScript.Shell")
cmd= "start blah.bat"
WshShell.Run (cmd)
Else
Wscript.Echo "File does not exist."
End If

may do it.
Old 19 September 2003, 06:36 PM
  #5  
Davie
Scooby Regular
Thread Starter
 
Davie's Avatar
 
Join Date: Sep 2002
Posts: 530
Likes: 0
Received 0 Likes on 0 Posts
Post

Cheers,

I'll give that a try.
Old 19 September 2003, 07:04 PM
  #6  
Soulgirl
Scooby Regular
 
Soulgirl's Avatar
 
Join Date: Dec 2002
Location: Here!
Posts: 5,145
Likes: 0
Received 0 Likes on 0 Posts
Post

My husband says Daves reply is the best
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
m18use
Computer & Technology Related
4
05 September 2002 09:00 PM
Ricochet
Computer & Technology Related
10
26 August 2002 07:02 PM



Quick Reply: VB Script Help



All times are GMT +1. The time now is 02:27 PM.