User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Windows NT / 2000 / XP / 2003 section within the Tech Talk category of DaniWeb, a massive community of 392,090 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,939 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Windows NT / 2000 / XP / 2003 advertiser:
Views: 3908 | Replies: 3
Reply
Join Date: Apr 2007
Posts: 6
Reputation: abhishekshete is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
abhishekshete abhishekshete is offline Offline
Newbie Poster

Help How can i suppress a user prompt while running a batch file in windows 2000 machin

  #1  
May 2nd, 2007
How can i suppress a user prompt while running a batch file in windows 2000 machine??
thanks in advance.
Abhishek
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2007
Posts: 2,510
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 105
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: How can i suppress a user prompt while running a batch file in windows 2000 machin

  #2  
May 3rd, 2007
It depends on what you are doing.

Some commands have a /b or /n switch to tell them they are being run from a batch file (and to suppress prompts.)

Another way is to have input and output redirection. But the input file must have all of the correct responses in the correct order (and the batch file can go horribly wrong if an unexpected error prompt appears. Put the redirection in the command line that starts the batch file, or in the batch file line which starts the command.

< redirects input, > redirects output, >> redirects error messages. There must be no space between the redirection sysmbol and the file.

dothis.bat <promansr.txt >digester.txt
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Apr 2007
Posts: 6
Reputation: abhishekshete is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
abhishekshete abhishekshete is offline Offline
Newbie Poster

Re: How can i suppress a user prompt while running a batch file in windows 2000 machin

  #3  
May 3rd, 2007
I didnt get a clear cut picture. Can u plz explain it with an example.But the >> is a command for appending.
Thanks in advance,
Abhishek.
Reply With Quote  
Join Date: Jan 2007
Posts: 2,510
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 105
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: How can i suppress a user prompt while running a batch file in windows 2000 machin

  #4  
May 5th, 2007
You are right, I was thinking of the OS-9 similar redirections. DOS uses >> for append.

In my example, dothis.bat is the batch file.

promansr.txt is a text file full of the expected responses to prompts, one response per line.


e.g. (I put the question over to the right. it is not part of the file)

y        (are you sure?)
n        (send to printer?)
          (Press ENTER to continue.)
y        (Replace the file? y/n/c=cancel)

digester.txt takes all of the output and "digests" it. You need to remove the file between runs of the batch file. You can do this by calling another batch file which deletes the file (and the two batch files could delete each other's files).

ECHO OFF

this command as the first line of a batch file also removes a lot of queries.
Daylight-saving time uses more gasoline
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Windows NT / 2000 / XP / 2003 Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Windows NT / 2000 / XP / 2003 Forum

All times are GMT -4. The time now is 12:39 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC