Solved

VBS Modification Needed

Posted on 2013-01-07
5
443 Views
Last Modified: 2013-01-07
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
0
Comment
Question by:elwayisgod
  • 3
  • 2
5 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 38752381
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

0
 

Author Comment

by:elwayisgod
ID: 38752405
My first two lines of the 'splice_years.vbs' is:

Option Explicit

Const C_DATA_DIR = ".\" ' "D:\AppFiles\SDS\SDS_Retail_R3\Data\"
0
 

Author Comment

by:elwayisgod
ID: 38752813
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.....
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 38752857
Right, but you have the data folder commented out...

Change it to read
Const C_DATA_DIR = "D:\AppFiles\SDS\SDS_Retail_R3\Data\"

Open in new window


What you have above simple sets it to ".\" which means 'present directory'
0
 

Author Closing Comment

by:elwayisgod
ID: 38752894
Thanks.  Missed that.  Works great.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

820 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