Link to home
Start Free TrialLog in
Avatar of elwayisgod
elwayisgodFlag for United States of America

asked on

VBS Modification Needed

OK.  When I launch the 'splice_years.vbs' form the command prompt in the 'scripts' direcotry, I get the below error.  I had to copy the 'actfisc.txt' file into the 'scripts' directory from the 'data' directory.  It processed the 'actfisc.txt' file ok, but when it tried the next file it errored out.  Why can't it look in the 'data' directory for the data files and process them there while the script remains in the 'script' directory?


D:\AppFiles\SDS\SDS_Retail_R3\Scripts>cscript splice_years.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

start - 1/7/2013 11:25:52 AM
file actfisc.txt - 1/7/2013 11:25:52 AM
D:\AppFiles\SDS\SDS_Retail_R3\Scripts\splice_years.vbs(26, 2) Microsoft VBScript
 runtime error: File not found


D:\AppFiles\SDS\SDS_Retail_R3\Scripts>cscript splice_years.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

start - 1/7/2013 11:26:31 AM
file actfisc.txt - 1/7/2013 11:26:31 AM
file actppln.txt - 1/7/2013 11:26:55 AM
D:\AppFiles\SDS\SDS_Retail_R3\Scripts\splice_years.vbs(26, 2) Microsoft VBScript
 runtime error: File not found
splice-years.vbs
Avatar of sirbounty
sirbounty
Flag of United States of America image

Because C_DATA_DIR is pointing to the current directory (scripts).
Change that line back and it should work:
Const C_DATA_DIR = "D:\AppFiles\SDS\SDS_Retail_R3\Data\"

Open in new window

Avatar of elwayisgod

ASKER

My first two lines of the 'splice_years.vbs' is:

Option Explicit

Const C_DATA_DIR = ".\" ' "D:\AppFiles\SDS\SDS_Retail_R3\Data\"
OK. I'm an idiot as I forgot about trigger file.  So it's executing now.  However it's still requiring my data files to be in the 'scripts' directory not the 'data' directory.  The second line of the 'splice_years.vbs' is:  Const C_DATA_DIR = ".\" ' "D:\AppFiles\SDS\SDS_Retail_R3\Data\"

thus very confused here.....
ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.  Missed that.  Works great.