You could shorten it with
For /l %%a in (1,1,9) do (
c:\pathToScript\Script 1.11.111.111 < c:\pathOfInput\input%%a.sc
)
Main Topics
Browse All TopicsI am using MSDOS.
Ver Command brings this up.
Microsoft Windows XP [Version 5.1.2600]
I am running a batch file named main.bat. If i browse to the folder and run the main.bat , it works correctly.
If i use an external software it returns me an error:
The system cannot find the file specified.
In my application i need to use the external software.
Can you please recommend why is this error showing up and how can i fix it ?
The contents of the main.bat file are below:
script 1.11.111.111 <input1.script >output1.xls
script 1.11.111.111 <input2.script >output2.xls
script 1.11.111.111 <input3.script >output3.xls
script 1.11.111.111 <input4.script >output4.xls
script 1.11.111.111 <input5.script >output5.xls
script 1.11.111.111 <input6.script >output6.xls
script 1.11.111.111 <input7.script >output7.xls
script 1.11.111.111 <input8.script >output8.xls
script 1.11.111.111 <input9.script >output9.xls
"script" is a proprietary script that reads data from input1.script file, writes the data to the device with ip address 1.11.111.111 and then reads from the device and outputs to the output1.xls and so on.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Sir bounty.
Thanks for all the above info. I tried all three. The first two worked. Great Help ! Then i put these main.bat files in c drive just to make sure it works and it worked !
The third code from Line 17 to line 21 did not work.
Can you please take a look at the above and see what might be wrong with this code ?
The above method is great when the input file names and output file names are in a sequence.
Question 1. But in few scripts i have the input with 9 or more different names and output with equally 9 or more different names.
What shall i do in those cases ? I am asuming that i just need to use this once in those cases.
cd /d D:\SimcoeTests\Plus16x\del
and it should work.
Question 2. This is a very good method but when if i copy it to a different folder or computer then i need to change the path name in each and every file. The entire purpose of automation was one point start to finish. This is not a big setback but is there a way i could update the folder path automatically. e.g i copied it to folder D:\new. It updates to that path in the main.bat file.
Sorry mate - my brain is already half-frizzled for the day....so my apologies in advance:
If the first 2 work - you're wanting to get the 3rd one working - why? Just for curiousity?
What it 'should' do (the 3rd one) is append that to a temporary path environment. Problem is that it would be a volatile environment and wouldn't remain for any subsequent calls. Another option though would be to either manually add that to your system-wide path, or automate it through code (but this would be a bit more work for something so simple).
That said, add some troubleshooting steps in there, such as:
@echo off
set Path=%path%;D:\SimcoeTests
Echo. Your path is now: %path%
pause
REM If the above is not showing the OneMinute path, then something is wrong...
For /l %%a in (1,1,9) do (
Script 1.11.111.111 < input%%a.script > output%%a.xls
)
Now for my ignorance...
Question 1: - I don't follow at all - what do you mean here? If you're simply saying that some may be 10,11,12, etc - just increment that 9 in the (1,1,9) block.
Question 2 - I didn't get either. You can move a file anywhere you like if you hard code the path, but of course, it requires updating each time you relocate it (if you have any supporting/dependencies in the new folder).
I just wanted to make the third one t olearn something. Just by asking that question i learnt how to troubleshoot whihc i would have missed.
My apologies for not making it clear earlier.
script 1.11.111.111 <moscow.script >russia.xls
script 1.11.111.111 <beijing.script >china.xls
script 1.11.111.111 <usa.script >newyork.xls
script 1.11.111.111 <sirbounty.script >expertsexchnage.xls
I just meant to say that the input and the output filenames can be different. in that case i should add one line to themain.bat file:e..g
cd /d D:\SimcoeTests\Plus16x\del
Let us forget the Question 2. I can live this.
Ah...I think I see (and it's not you, really - it's me - haha...lack of sleep, long story...)
You can create other loops - I was just suggesting the 'counting' loop to meet your initial requirements.
For /l performs a loop (1,1,9) - starting at #1, incrementing 1 each loop, and ending at #9.
Just as easily, you can choose to go this route:
for /f "tokens=1,2" %%a in (moscow russia beijing china newyork usa) do call :process %%a %%b
and then in process routine, you'd be able to reference moscow as %1 and russia as %2 (paramters).
All depends on what you're aim is...try a for /? from the command line to get a help text on it.
And as stated in your other thread - you could also develop a file to correlate between input and output parameters to use...
Sir bounty
Lack of Sleep. Long hours at Work. Same story here. I have learnt more today than in any other day. I guess i can simplify some of my work with your above suggestions. I tried debugging with that command you told me before. This is what i got.
Your path is now: c:\program files\ca\dcs\dmscripting\;
The system cannot find the file specified.
I got the error again. I dont know why is this happening. Do you think the software might be doing something ?
Well, for one your path has two semicolons - I'd say manually correct that. Probably not a problem - and most certainly not the issue, but you still want to clean bug guts off your windshield even if they aren't on the driver's side, right? :^)
The path variable seems to have gotten updated otherwise.
However, I'm curious where the "cannot find the file" error came in - was that after 'press any key'?
Oh (doink) - just realized - it was my own goof...
Just because you update the path, doesn't make this thing work! (See - told you I was tired).
See - supplying the path will allow 'script' to work (script.exe presumably?), but it won't identify the location of input & output (although technically output will be just happy as a lark to save to the present folder).
Input is going to be the one that makes script go "Input? What input? I've got no input here..."
So, that would be why option #3 failed.
To correct it...use this:
Sir Bounty
I will test this on Monday. I choose not to go to work on Saturday. I was very tired and i needed this break. The weather was nice though thunderstorms were there.
Thank you very much for your reply. I really appreciate your support. We will touch base on monday. I hope i am able to get this working.
Thanks sir bounty. With your help i was able to write the correct scripts. However i am not able to execute the scripts with the external software. I keep on getting the error "The system cannot find the file specified". I think since my original question was answered this question should be closed. I will create another question for the problem.
Business Accounts
Answer for Membership
by: sirbountyPosted on 2008-05-30 at 10:03:50ID: 21679528
Specify the full path for script...