Need Help in DOS Scripting

Closed
Kiran - May 19, 2009 at 01:54 AM
 Kiran - May 19, 2009 at 05:48 AM
Hello,

I need to use the follwing script as a batch file.

cd D:\
md migration
cd migration
md SourceCatalogs
md TrgtXMLs
cd..
cd Catalogs

:begin
Set /P catalog= Please Enter your catalog name :
REM check whether a catalog called %catalog%.cat exists
IF EXIST %catalog%.cat GOTO :success
IF NOT EXIST %catalog%.cat GOTO :error

:error
ECHO Error - can't find the %catalog%.cat file Enter Again
GOTO :begin

:success
copy D:\Catalogs\%catalog%.cat D:\Migration\SourceCatalogs\%catalog%.cat
C:
cd "C:\Program Files\cognos\cer5\migs7"
impcat2xml D:\migration\SourceCatalogs\%catalog%.cat D:\migration\TrgtXMLs\%catalog%.xml
del D:\migration\SourceCatalogs\*.*
pause
GOTO MENU


when I enter 1st time its works fine, after that what ever i enters it points to Not Exist only.
kindly help
Related:

2 responses

Hi

you need to create bat file

copy con file name.bat followed by the enter
enter the information in file and then press f6 for save
Hi Zubair,

Thanks for your Answer.

Actually i saved the above script as a .bat file and running.
1st time if i enter "aaa" which was not there in that path it prompts me to enter again.
But if i enter "bbb" which was there in that path it runs fine.
now again it go to menu.
Now If I enter "bbb" or "ccc" which were there in the path it needs to run but it prompts me to enter again.
So I understood that loop works fine 1st time but not later.
Any help matters.
Thanks.