Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

command line - imputting popup prompt answer

Status
Not open for further replies.

wiimike

IS-IT--Management
Mar 30, 2007
145
US
Hey guys,

Sorry for the possible misplacement of this thread, I honestly don't know what type of programming batch files are.

I'm trying to write a batch file to do something I do with start -> run ->type it in -> hit enter.

I have it down to the hit enter but am stuck.

basically, I have a command that fixes the database files for some group policy stuff (on a desktop PC), "esentutl /p c:\Windows\Security\database\secedit.sdb" and I want to make it a bat file that doesn't prompt the user at all, and just fixes what I need to fix.

so I made a file with a .bat extension, containing
Rem * this is to fix the Group Policy database file(or something close) to allow group policies to take affect *
esentutl /p c:\Windows\Security\database\secedit.sdb

When this runs it prompts the user with "ok" or "cancel" options. I want to make it hit "ok". and I'd also preferably but it's a separate issue prevent a window from coming up at all.

Any idea how to do this? You guys have screwed with command line'ish scripting a lot more than I have, was hoping you could shed some light
 
You are doing it all right, I'd try adding a /y at the end of the line. Or a /silent
 
The options for esentutl don't appear to include a /y or /silent option so you'll need to fall back on the old trick of creating a file containing the character you wish to send and piping that into esentutil.

something like:
Code:
rem ? is the character you need to 'press'. The echo command is piped to a file called y.txt
rem try echo. if you just want a CRLF but it also outputs a space
echo ? > y.txt
rem y.txt is piped into esentutil
esentutil /p c:\Windows\Security\database\secedit.sdb < y.txt
rem get rid of the file
del y.txt

Bob Boffin
 
I have tried running the batch file you haved listed and it doesn't produce an OK or Cancel message for me.

What exactly does the OK or Cancel message say as it probably indicates some other error in your code?





Bob Boffin
 
esentutl /p c:\Windows\Security\database\secedit.sdb /o

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
OK I understand it now. When you run esentutl in a batch file and ask for a repair it throws up a message as a dialog.

The undocumented /silent switch will suppress this popup.


Bob Boffin
 
Thanks for the help guys. Especially ebgreen, that worked perfectly!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top