• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3365
  • Last Modified:

Batch Script .bat switch that autoconfirm dialogs on XP SP3?

I had been using perfectly a batch scrip using /y switch for auto confirmation or supress dialogs on windows xp sp2, but when i update to windows xp sp3 that switch stoped working and i cant find information anywhere, any ideas how i can make this work again?..

Example for the batch script what used to work: install.bat
"setup.exe" /SILENT /Y

Any ideas or solution?
0
xpertoPC
Asked:
xpertoPC
  • 7
  • 5
  • 4
  • +1
2 Solutions
 
Rob WilliamsCommented:
There are numerous "switches"/options for installation of SP3. You can find these by browsing to the folder that contains the exe, using a command prompt, and running:
WINDOWSXP-KB936929-SP3-X86-ENU.EXE  /?

To run it without user intervention use:
WINDOWSXP-KB936929-SP3-X86-ENU.EXE  /quiet
(silently in the background)
or
WINDOWSXP-KB936929-SP3-X86-ENU.EXE  /passive
(displays a progress bar)
0
 
xpertoPCAuthor Commented:
Im not trying to install SP3, i already have it. The problem that i have is a with any simple batch script that should autoacept or autoconfirm any dialog that apears, with SP2 installed i had no problem with the /Y switch but now with SP3 installed it doesnt work the /Y switch something changed with the SP3.
0
 
Rob WilliamsCommented:
Sorry I see what you are saying now. I mis-understood.
The switches (silent & Y) are functions of your setup.exe app not Windows, so it is odd that SP3 would handle them differently. Upon testing other /Y and /Q switches for other apps they seem to work in the same way with SP2, SP3 and Vista.
Sorry I have no suggestions other than to contact the setup.exe vendor. Perhaps others will have suggestions.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
xpertoPCAuthor Commented:
The problem is not on the setup.exe vendor, i know its on the change from XP SP2 to XP SP3 because the same command stoped working after that on all diferent batch scripts that i have made.

On many of the research i have made i saw something that it changed because they add some new ways to confirm diferent new messages like Yes/No/Cancel/Close/Later (something like that) i think this changed for Vista too so maybe thats why the update to XP SP3.

I Found this information on some Batch Script Site that is what i need to do un my scripts on XP SP3:

http://www.rohitab.com/discuss/lofiversion/index.php/t1215.html

The parameter /y, this informs the process to answer "YES" to any confirmation questions. Sometimes you type the DEL or one of its cousins, the system will ask "Are sure you want to do this?" setting /y answers these prompts without interupting the process.

I have been searching a lot for this i hope someone can lend me a hand. Thanks for helping RobWill
0
 
Rob WilliamsCommented:
There is no question Microsoft has made minor changes to DOS commands with many Windows versions from NT to Vista. They are generally just that, minor, and often frustrating to figure out the subtle differences. However, switches such as del (delete) /q for silencing the confirmation request still work for Vista and XP SP3. My point is the switch values are determined by the .exe not Windows. For example one DOS command may use /y for confirmation and another /q but the particular .exe determines that, it is not a general switch applied to all Windows/DOS commands.
0
 
xpertoPCAuthor Commented:
Well i used that switch for other scripts and i have the same problem for example to auto install and register AnyDVD would be like this:

Install.bat
"AnyDVD.exe" /S /NORESTART <--- this switches are from the .exe has you mention.
"Key.AnyDVD" /Y <--- But this is from windows batch scripting

The files remain the same, on XP SP2 work well, and on XP SP3 dont, thats why i belive that this particular switch has changed and is not from the setup.exe file.

Check the screen shot attachment that shouldnt apear, or should be auto confirmed son XP SP3 but it doesnt:

Screen-Shot.JPG
0
 
Rob WilliamsCommented:
That is not a Windows message. The pop up is from your application. It is possible th application is not compatible with SP3, but I do not believe any DOS command switches have changed with SP3.
Also a Google of that message implies the license or trial period for ANYDVD has expired.
0
 
xpertoPCAuthor Commented:
And how do you explain that both same code and files work on SP2? i dont see that message or any confirmation boxes, it just gets the job done.

Also a Google of that message implies the license or trial period for ANYDVD has expired.
<-- This message depends on AnyDVD if is registered with or not, with the file that belongs to the version, etc.
0
 
Rob WilliamsCommented:
Sorry I do not know. As mentioned I have seen no change in DOS switches with SP3. Perhaps others will have some suggestions.
0
 
Netman66Commented:
try this:

echo Y | setup.exe /s

Hi Rob!
0
 
BillDLCommented:
Try Netman66's suggestion above.  My comment is just for your additional information and also

There are so many different versions of installer packages that it is sometimes hard to know from the packaged installer what switches may be used.  For example, most packages created with "InstallShield" are "Windows Installer" (msiexec.exe) compliant as far as setup switches are concerned.
http://support.installshield.com/kb/view.asp?articleid=q105473

However, you also have:

1. InstallMaster/Wise Installation System from Wise Solutions - supposed to comply with the standard switches, but sometimes does not:
http://www.wise.com/
2. Inno Setup - open source competitor documented here:
http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html
3. Nullsoft Scriptable Install System (NSIS) - open source packager:
http://nsis.sourceforge.net/
4. Ghost Installer by Ethalone - commercial packager:
http://forum.ethalone.com/
5. Plenty more like "Setup Factory" - http://www.indigorose.com/setup-factory/

Other methods of creating automated scripts and compiling them into standalone *.exe's is exemplified by AutoIT3:
http://www.autoitscript.com/autoit3/

Others:

http://support.microsoft.com/kb/231747/EN-US/
http://support.microsoft.com/kb/257718/EN-US/
http://support.microsoft.com/?id=264478

Windows XP's "iexpress.exe" repackager:
http://support.microsoft.com/?id=197147

OK, so the actual "package" may allow for standard or company-specific switches, but once the package is opened to the %TEMP% folder, or wherever, the Windows Installer may then be called and other switches may apply that could not have been used on the original package.

For this reason I normally fully unpack setup packages using WinZip, WinRAR, the Extract or Expand commands, and any other means possible to try and establish what's inside.  In some cases the process is governed by a setup configuration file (eg. an *.ini) that is plain text and editable in Notepad.  In other instances it's one of those cheap home-baked "installers" that is nothing more than an outer wrapping for standard Windows Installer files.

You will find a lot of pre-written setup scripts for common software here:

http://ubertechnique.com/unattended/Scripts
http://www.appdeploy.com/packages/
http://www.msfn.org/board/lofiversion/index.php/f80.html
http://www.msfn.org/board/Application-Installs-f80.html

In answer to your AnyDVD Question:

http://www.slysoft.com/download/changes_anydvd.txt
Look down to the 2nd change in version "6.4.0.5 2008 03 30":

"Change (Setup): Removed ability to install without a reboot, because some faulty 3rd party drivers crash".
0
 
xpertoPCAuthor Commented:
Sorry for the delay, Ill check out all the switches, but how can i identify wich installer is the setup.exe compacted with?

Im looking for a standard switch for a batch script that does the job its something like Netman66 wrote but didnt work for me.

echo Y | setup.exe /s

What other switches can work? /Y /yes /s |Y |Yes Y| Yes| /q /quiet (Non of this supress the message at the end)

Maybe ill have to start explaining what im trying to do exactly:

I want to uninstall LiveReg silently and this is the batch script i think it worked for me:

Removing LiveReg:
"%programfiles%\Archivos comunes\Symantec Shared\LiveReg\VcSetup.exe" /SILENT /REMOVE /Y

Registering AnyDVD:
copy Key.AnyDVD "%programfiles%\SlySoft\AnyDVD"
"%programfiles%\SlySoft\AnyDVD\Key.AnyDVD" /y
"%programfiles%\SlySoft\AnyDVD\Key.AnyDVD" /yes
"%programfiles%\SlySoft\AnyDVD\Key.AnyDVD" |Y (Any of this supress or acepts the message)

But the /Y switch i think is the one not working for me now. But what i want to learn is how to supress, confirm any dialog that i get on any other batch script that i make. This two messages that i get one on AnyDVD and one on LiveReg are part for each .exe?, what i mean isnt there a way for the .bat to do that for me.

For example here is a screen shot for LiveReg and the message i get when i remove it silently.
Screen-Shot.jpg
0
 
BillDLCommented:
xpertoPC

I'm not sure what the purpose is of copying the file named "Key.AnyDVD" to those folders, but I assume that it is to place a file containing the registration details in the folder where anyDVD will look it when first run.  I also assume that this file is normally created when you install the program and then manually enter registration details, and that you have copied out this file from a previously installed and registered copy of the program.

To know the acceptable switches for the COPY command, just type   COPY /?  in a command window.

COPY [/switches] sourcefile.ext destinationfile.ext

It is good practice to use the switches telling the copy command whether the files are ascii (plain text) files or binary (usually like program) files as indicated by the /a and /b switches in the COPY /? results, but it usually doesn't make much difference in the end.  The switches you  are concerned with are /y and /-y.

/Y   Suppresses prompting to confirm you want to overwrite an existing destination file.

/-Y  Causes prompting to confirm you want to overwrite an existing destination file.

The default is to prompt, so you just need to add a /y to your command like this:


copy /y Key.AnyDVD "%programfiles%\SlySoft\AnyDVD"


Actually, I always prefer to issue the command in the full way like this:

copy /y Key.AnyDVD "%programfiles%\SlySoft\AnyDVD\Key.AnyDVD"

Used with the copy command as above, you would see the screen output: "1 file(s) copied.".
If you wanted to totally suppress that output and also FORCE a copy and file overwrite without prompting, then you can redirect the screen output into "nul" and you don't have to use the /y switch.  This does just as it says.  You are sending the screen output into thin air.

copy Key.AnyDVD "%programfiles%\SlySoft\AnyDVD\Key.AnyDVD" > nul

If you preferred, you could send the screen results to a text file to create a log like this:

@echo off
set KEYFILE=Key.AnyDVD
set DEST=C:\Program Files\SlySoft\AnyDVD
set LOGFILE=AnyDVD_Log.txt
::
echo Registering AnyDVD > %LOGFILE%
echo Copying %KEYFILE% to %DEST% >> %LOGFILE%
copy %KEYFILE% "%DEST%\%KEYFILE%" >> %LOGFILE%

Your Log File ("AnyDVD_Log.txt" in the same folder as your batch file) will contain the line "1 file(s) copied."


If you really want a full blown log file with details of activities, then the batch file in the CODE SNIPPET will do that.  I am only including this batch file as an example to demonstrate how to test for success or failure when you are not seeing any screen output, as happens when you redirect screen output to "nul" or to a text file.  Perhaps this method, and also the method of using the SET command to create variables, might be useful to you if you write a much more complex batch file that does several things.

The > redirection sends what would normally be displayed or echoed on screen to the file, and creates the file if it doesn't already exist. If the file already exists, then any content will be overwritten.  The >> redirections ADD whatever is redirected to the file AFTER any existing content, without overwriting it.

As far as your silent "LiveReg" uninstallation goes, can I suggest something to you that may assist.  To find out Setup and Uninstall commands for programs (in this case Symantec LiveReg, but you may wish to know others), you have several options:

1. Ask here in Experts-Exchange, and you will find that we will do the steps detailed at No. 2 onwards.

2. Do a google search for key words like "silent install uninstall setup switch symantec livereg" and then experiment with what the results pages tell you are acceptable command line switches.

3. Read any Readme file that is on the program CD, in a downloaded *.zip package, or on the download page for the program, or search the vendor's online support knowledgebase using keywords like "command line setup switches livereg" or "livereg deployment command line".

4. Install the program and search the program's Help file for the type of words detailed above.

5. After installing a program, open REGEDIT and go to the key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall]
Expand that key to display sub-keys in the Left pane, and look for one named after the program.  If you an't see one with the program name, then you have to click your way down on each sub-key.  Look in the RIGHT pane for the name of the program as displayed in Control Panel > Add/Remove Programs.  It should show against a value named "DisplayName".  Now look for a value named "QuietUninstallString".  If one exists, then double-click on it (or Right-Click > "Modify") to see the full command that you can note down or copy and paste from there to Notepad.

Here is the relevant registry key for LiveReg version 2.4.2.2295 exported to a *.reg file.  I found this in a quick google search (I have changed the \\'s you would get in a *.reg file to single \'s):

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LiveReg]
"DisplayName"="LiveReg (Symantec Corporation)"
"UninstallPath"="C:\Program Files\Common Files\Symantec Shared\LiveReg\VcSetup.exe"
"UninstallString"="C:\Program Files\Common Files\Symantec Shared\LiveReg\VcSetup.exe /REMOVE"
"QuietUninstallString"="C:\Program Files\Common Files\Symantec Shared\LiveReg\VcSetup.exe /SILENT /REMOVE"
"InstallLocation"="C:\Program Files\Common Files\Symantec Shared\LiveReg"
"DisplayVersion"="2.4.2.2295"
"Publisher"="Symantec Corporation"
"NoModify"=dword:00000001
"NoRepair"=dword:00000001


Here is an explanation of each value name:

DisplayName = What you see in Add/Remove Programs
DisplayVersion = What shows in Add/Remove Programs in Windows XP
Publisher = self-explanatory
UninstallPath = The file called when you choose "Uninstall"
InstallLocation = The folder in which the file above resides
UninstallString = The command executed for a normal Uninstallation
QuietUninstallString = Same as above, but SILENT!
NoModify = If value is 1, then you can't do a "Custom" install
NoRepair = If value is 1, then you can't run a "repair" install.


So, your Silent Uninstall command is:

"C:\Program Files\Common Files\Symantec Shared\LiveReg\VcSetup.exe" /SILENT /REMOVE


NOTE:

This applies ONLY to LiveReg, and some of the values in the above *.reg file will only apply to programs that install and uninstall in that same manner.  Some that DO install and uninstall in the same way may use switches like the following for another Symantec program named "sevinst.exe" hat is described here: http://service1.symantec.com/SUPPORT/ent-security.nsf/docid/1998092408260848

"C:\Program Files\Common Files\Symantec Shared\SEVINST.EXE" /U /Q


When it comes to programs and applications that install and uninstall using the Windows Installer MSIEXEC.EXE method, then they call msiexec.exe with the relevant *.msi file name and the proper command line switch.  These switches are in the first link of my previous comment and here:
http://support.microsoft.com/kb/314881/EN-US/


msiexec.exe /x /qn Drive:\Path_To\package.msi

msiexec.exe /i /qn Drive:\Path_To\package.msi

setup.exe /i /qn

where:
/i - Install
/x = Uninstall
/qn = Quiet Mode + No progress

/qn+ would give you only one dialog on completion.


Many "setup.exe" files packaged with a Windows Installer-compliant program (even if not actually named "setup.exe") can be unpacked using WinRAR to reveal the actual *.msi file.  If you see an extra "SFX" tab in a file's Right-Click > Properties, then it is a "Self Extracting" Archive.

NOTE:
Not all "QuietUninstallString" values shown in REGEDIT for *.msi type installers will show a proper "quiet" uninstall command, because uninstalling is usually a much safer thing to do and would be what the author intended.


So in summary (and this has been repeated several times), you can control what happens and doesn't happen using command line switches ONLY IF the setup package recognises the switches being passed to it.

Using /y, or whatever switch you want to try using, will only work to control what can physically be done AT THE COMMAND LINE unless the setup package happens to recognise a /y switch being passed to it.

In your example screenshot of LiveReg Uninstaller showing a restart prompt, you CAN'T script a batch file that clicks the "Aceptar" (or any other) button for you. You CAN, however, create a script in AutoIT3 and convert it to an *.exe file that WILL be able to click buttons for you.  That was the reason I suggested it a while back.

What you now need to do is be able to recognise the setup files for the methods 1 to 5 that I detailed in my previous comment, and know what commands and switches can be used with each type.  The best way to learn this is to actually INSTALL the programs yourself and then check in the registry to see what the Uninstall command is.
 
The ones that place a log-type file (sometimes an *.inf file and often a file named "Uninst.isu")  in the program folder when you install a program, and then use that for instructions when uninstalling, are quite easy.  You can copy out that file and study it to see how it works, and take a note of the syntax for the setup or Uninstall commands in the registry.

Regards
Bill
@echo off
::
set KEYFILE=Key.AnyDVD
set DEST=C:\Program Files\SlySoft\AnyDVD
set LOGFILE=AnyDVD_Log.txt
::
echo AnyDVD Registration Log File > %LOGFILE%
echo ============================ >> %LOGFILE%
echo.  >> %LOGFILE%
echo Registering AnyDVD >> %LOGFILE%
echo Copying %KEYFILE% to %DEST% >> %LOGFILE%
::
copy %KEYFILE% "%DEST%\%KEYFILE%" > nul
if errorlevel 1 goto :ERR1
if errorlevel 0 goto :SUCCESS
pause
::
:ERR1
echo.  >> %LOGFILE%
echo ***** ERROR ***** >> %LOGFILE%
echo. >> %LOGFILE%
echo Unable to copy file %KEYFILE% to folder: >> %LOGFILE%
echo %DEST% >> %LOGFILE%
echo because file %KEYFILE% cannot be found in >> %LOGFILE%
echo folder %~dp0 >> %LOGFILE%
goto :END
::
:SUCCESS
echo. >> %LOGFILE%
echo File %KEYFILE% copied successfully to >> %LOGFILE%
echo folder %DEST% >> %LOGFILE%
goto :END
::
:END
set KEYFILE=
set DEST=
set LOGFILE=
exit

Open in new window

0
 
Rob WilliamsCommented:
I seem to be missing the issue here I think.
You say; "Im looking for a standard switch for a batch script ". The "silent" switch is not for the batch script, but for the command/application within the batch script such as setup.exe, AnyDVD.exe, copy, del, etc. Is this correct?
If so, there is no such thing as a standard switch. The switch options are determined by whomever wrote the particular application/command, and can be different for every one.
Perhaps I am totaly misunderstanding the question.
0
 
BillDLCommented:
Hi Rob.
On the contrary, I believe that you have understood the question, but that xpertoPC has misunderstood the differences between suppressing (a) command line prompts and (b) Windows dialogs generated by a setup routine.  This is exemplified by the screenshots of dialogs where he/she asks why the command switch wasn't able to automatically accept it.

xpertoPC maintains that batch files which worked on XP SP2 to autoconfirm dialogs (not command-line prompts) now do not work in SP3, but did not grasp the difference between switches applied to the COPY command and those applied to a setup.exe file.

Unfortunately xpertoPC's main other source of reference were quoted as:
"Batch for idiots II":
http://www.rohitab.com/discuss/lofiversion/index.php/t1215.html
in which someone gave the XP command and switches to silently delete a folder and all contents with backslashes instead of forward slashes.
A more appropriate topic for the above linked page would have been "Batch BY idiots II", and must surely have been misleading to someone who is struggling to understand the issues.

I'm hopeful that our combined explanations will finally be understood by xpertoPC.  I know my last comment was pretty long, but hopefully step-by-step it should reiterate what you have already tried to explain.

Bill
0
 
Rob WilliamsCommented:
Hi Bill, perhaps I am not that far off track then :-)
--Rob
0
 
BillDLCommented:
Thank you Lee
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

  • 7
  • 5
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now