Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Commands .bat
Hi , I need some assistance to execute multiple commands from a .bat file on a cmd prompt.
e.g. I am executing an exe :
D:
cd \
cd "D:\AWD_NT\BIN"
 
USERIDMGREX.EXE awd.ini
 
The problem I am facing is that I need to execute 2 more commands after that in the same "USERIDMGREX.EXE" .exe.
 
the commands i need to run are :
 
"dumpids" and "delid" ... and "delid" takes another parameter , e.g. "delid TMOODLEY". These need to be executed in the same exe above("USERIDMGREX.EXE").
 
Any help would be greatly appreciated. thanks
Posted 10-Nov-11 23:25pm
Rico_5.7K
Edited 10-Nov-11 23:42pm
Mehdi Gholam253.6K
v2
Comments
Richard MacCutchan at 11-Nov-11 4:44am
   
So add those commands to the .bat file. What exactly is stopping you?
Riccardo Moodley at 11-Nov-11 5:04am
   
the exe is a console app and its not accepting the parameters ... I'm doing something wrong but dont know what.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

How USERIDMGREX.EXE works is not clear from the question. If it is a program that displays it's own prompt and waits for the user to type an input then it may be possible to redirect standard input from a file. This is most easily demonstrated with the command processor itself and a text file containing one command per line.
 
e.g. commands.txt
echo Display system time and date
time /t
date /t
 
At a command prompt we can issue the command
e:>cmd < commands.txt
 
and see the output
e:> cmd < commands.txt
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
 
e:>echo Displaying time and date
Displaying time and date
 
e:>time /t
10:55
 
e:>date /t
11/11/2011
 
USERIDMGREX.EXE may respond to redirected input in the same manner
e.g. commands.txt
dumpids
delid TMOODLEY
 
and
USERIDMGREX awd.ini < commands.txt
 
Alan.
  Permalink  
Comments
Riccardo Moodley at 11-Nov-11 6:33am
   
works well ... i have put the commands in the the commands.text file. thanks alot.
RaviRanjankr at 11-Nov-11 15:36pm
   
My 5+
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If your .exe program is not accepting parameters then you need to look at the code. Changing the layout of the .bat file will not make any difference.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 504
1 Maciej Los 349
2 Kornfeld Eliyahu Peter 325
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,303
1 DamithSL 4,764
2 Maciej Los 4,306
3 Kornfeld Eliyahu Peter 3,914
4 Sergey Alexandrovich Kryukov 3,538


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 11 Nov 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100