Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Generating a batch file in DOS

Original Message
Name: Dosier
Date: January 8, 2008 at 10:50:24 Pacific
Subject: Generating a batch file in DOS
OS: Windows XP
CPU/Ram: 2 GB
Model/Manufacturer: 2007
Comment:
Hi!!

I need to write a batch file to run an Integration scenario.

I am going to explain you better about my problem: your solution is highly appreciated.

1) I have a batch file call 'find.bat' and I have other text file call 'tag.txt'.
2) In 'tag.txt' I store the file's name that I got from C:\SAPworkDir
For example 'tag.txt' could store:

Allocations_PlanOrd.txt
Allocations_ProdOrd.txt
BuyerCode.txt
Cd.txt
Customer.txt

3) I execute 'find.bat' and I want to read 'tag.txt', after reading each row, I want to execute the command : The fils is in existance or Not

4) then my execution should be:

- execute 'find.bat'
- for each row in tag.txt execute
find the file in the specified directory.then write a new batch file by stating "XXX file in in the directory"
end for


Thanks
Dosier


Report Offensive Message For Removal


Response Number 1
Name: JRell
Date: January 8, 2008 at 11:37:39 Pacific
Subject: Generating a batch file in DOS
Reply: (edit)
If I understand your request fully, then this should do the trick:

REM --------- begin here -----
@echo off
for /f "tokens=1*" %%i IN (tag.txt) do call :process %%i
goto :EOF

:process
rem %%a is passed to this subroutine as %1
echo %1
if exist %1 echo %1 is in the directory!

:EOF
REM --------- end here -----


Report Offensive Follow Up For Removal

Response Number 2
Name: JRell
Date: January 8, 2008 at 11:40:48 Pacific
Subject: Generating a batch file in DOS
Reply: (edit)
and for the minimalists out there:

@echo off
for /f "tokens=1*" %%i IN (tag.txt) do if exist %%i echo %%i is in the directory!


Report Offensive Follow Up For Removal

Response Number 3
Name: Dosier
Date: January 9, 2008 at 08:52:42 Pacific
Subject: Generating a batch file in DOS
Reply: (edit)
Hi JRell,

You did wonderful Job. Thanks a lot for your work. It minimized my effort.

I request you help for a small enhancement in the above code. If, I didn't found any one of the file from the specified directory with respect to tag File, then it has to create a batch file called empty.bat...

Hopefully, I am expecting a code enhancement from you. Once again thank you for your effort.

Thanks
Dosier.


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Generating a batch file in DOS

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




acer 312T BIOS problem

K7 Turbo possible max fsb?

Pc anywher problem

WinFLP & OE/Outlook2003

Computer resets after a few minutes


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC