Commands in a .bat file
I have a small .bat file. It was created to install an application as an administrator for Windows 7. Once the setup.exe file is executed (statement below), it will ask the user to click the "next" button a few times during
the application installation process.
Is there a parameter or command I can put after this statement where the application will install and the user will NOT have to keep clicking the next button?
%THISDIR%Elevate.EXE -wait4exit %THISDIR%Install\setup.exe
Thanks for any input or suggestions.
This depends entirely on whether your 'setup.exe' program has a command-line option (such as
/SILENT) that permits hands-free installation. That is not a question we can answer in this forum.
You need to ask the author(s) of your 'setup.exe' program whether this is possible. You can ask for vendor support or search for the package to find out whether you can do a silent install.
Bill
Similar Messages
-
Run powershell commands on a bat file
Hello,
I can call powershell on command line as below:
C:\>echo I am in Command Shell
I am in Command Shell
C:\>powershell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\> Write-Host I am in Powershell
I am in Powershell
PS C:\> exit
C:\>echo I returned to Command Shell
I returned to Command Shell
But I want to create a bat file and run these commands in bat file. To do this, I copied and pasted same codes to Test.bat file:
echo I am in Command Shell
powershell
Write-Host I am in Powershell
exit
echo I returned to Command Shell
But after "powershell" command nothing worked as below:
C:\>.\Test.bat
C:\>echo I am in Command Shell
I am in Command Shell
C:\>powershell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\>
I want this output:
I am in Command Shell
I am in Powershell
I returned to Command Shell
How can I handle this problem.
PS: I don't want to use powershell file (*.ps1).
ThanksIn my Test.bat file there are some commands. My Test.bat file is sth like this:
@echo off
echo I am in Command Shell
powershell.exe
Write-Host I am in Powershell
$Var = "Some words"
Write-Host My ID: $Id, String: $Var
exit
echo I returned to Command Shell
There are other different commands, such as importing modules or setting variables or configuring computer settings,.... So, I think "powershell -command" is not applicable.
In brief;
Above codes work in command line.
But when I use same codes in a batch file, nothing works in powershell. Result is sth line this:
C:\>Test.bat
I am in Command Shell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\> -
Picture Manager with command line for Bat files
Hello
I am wondering if Microsoft Picture manager has any command line switches i could use.
I resize thousands of photos weekly using Picture manager for a semi automated process. The resize is the part that is not automated. For some reason when using image magik the resize is done but it does not accept some images where i upload them, yet if
i do it in parallel with Office picture manager the Microsoft re-sized always work.
The process uses VB Access, downloads all images changes the extension from one card extensions to jpg and ammends the name. sorts the images to two folders.
Then i resize as a batch manually. Not difficult but needs hands on and have you tried changing the dimensions in picture manager when all are selected. tedious!
Then the final bat uploads to correct locations.
So my question, how to use command line with Microsoft picture manager. If not command line Powershell. I can not beleive that the program can not be opened specifying a folder and resize image dimension to use. I cant see the source code where i believe
it would be apparent to me how to do so.
Thank you
Sometimes the answer is so blindingly obvious i fail to see!I have done it before on BOXI R2 with the IW, and it works fine
But any how, this is the way that we have to work with, since it is part of a customer product and the link universe and it's reports is an additional part of the product.
So is there a way that I can pull just the main universe and it's reports? -
Executing commands within .bat file sequentially within the same cmd window
We have a .bat file that contains several commands. Each command invokes an .exe with arguments.
When I invoke the .bat file programatically using the command "cmd.exe /c myfile.bat", the commands are running parallelly.
Within the .bat file, I also tried using start "" /wait /b "myprocess.exe" instead of just
"myprocess.exe", but both gives the same result.
Any solution to this?
Note:
We use Windows 7 environment.I am invoking the batch programatically in c#.
As per your suggestion, I modified the code as below to execute bat file directly instead of using cmd.exe.
Process proc = new
Process();
proc.StartInfo.FileName
= "c:\\myfile.bat";
proc.Start();
But still I could see the parallel execution of commands within the bat file.
I was not able to use Call command as I have to invoke programatically.
Is there a way to invoke Call command from c#? -
Manual startup/shutdown of windows services using command prompt or .bat
Hi,
I know that we could shutdown and start of SAP in windows using the following commands in a .bat file.
SAP:
stopsap name=<SID> nr=<SYSNR> SAPDIAHOST=<host>
startsap name=<SID> nr=<SYSNR> SAPDIAHOST=<host>
OS Collector:
saposcol -k
Oracle Listener:
lsnrctl stop / start
How about the following services:
SAPDEV_00
OracleOraHome92Agent
OracleServiceDEV
How can I stop and start of these services in a batch file?
thanks,
kbasTry,
net stop <service name>
net start <service name>
Message was edited by:
Bidwan Baruah -
Running .bat files from java applications
Has anyone tried to run a .bat file from a java application?
I know I can run java commands by getting the application's runtime, but I've a number of *.bat files I like to run from the application without having to extract the commands from the .bat files.
thks,Crikey! You were answered very shortly after you posted your question, and you STILL haven't bothered to come back. And are you going to create a new userid the next time you ask a question, since bat2004 seems tied to this particular question?
-
Problem executing .bat file from within Java class
I'm stumped: I have no problem executing a .bat file that sets classpaths and executes a Java jar, but when I try to execute other executables first and then the .jar, my application hangs and since the DOS box doesn't come up over my GUI, I can't see what's going on.
This works:
public void execute() throws Exception {
String s = "c:\\cs47auxs\\omnijar\\omni.bat";
Process p = Runtime.getRuntime().exec("\"" + s + "\"");
p.waitFor();
JOptionPane.showMessageDialog(frame,
"The Database Has Been Successfully Reloaded.",
"Information Message",
JOptionPane.INFORMATION_MESSAGE);
Here's the .bat 'omni.bat'
set JAVA_HOME=c:\j2sdk1.4.2_04\bin
%JAVA_HOME%\java -jar C:\CS47AUXS\OMNILOADJAR\OmniLoad.jar
This doesn't work:
public void execute() throws Exception {
String s = "c:\\cs47auxs\\omnijar\\jobomni.bat";
Process p = Runtime.getRuntime().exec("\"" + s + "\"");
p.waitFor();
JOptionPane.showMessageDialog(frame,
"The Database Has Been Successfully Reloaded.",
"Information Message",
JOptionPane.INFORMATION_MESSAGE);
Here's the .bat file 'jobomni.bat'
SET NETX_HOME=C:\CS47AUXS
SET COBOL_HOME=C:\CS47AUXS\OFFLINE
CD %NETX_HOME%
CALL SET-NETX.CMD
CD %COBOL_HOME%
SSBPPC10 JOBOMNI X
SET JH=C:\J2SDK1.4.2_04\BIN
SET OMNI_HOME=C:\CS47AUXS\OMNILOADJAR
CD %OMNI_HOME%
%JH%\java -jar omniload.jar
Can anyone shed some light here? Even when I execute the application from the command line the new DOS box doesn't become visible nor can I see any errors. If I could just get that visibility, I could probably figure out what is going wrong.Same problem with me as well.... Badly looking for a solution...
I predict the following:
- If your batch file has pretty less number of dos/shell commands then it gets executed fine with exec() and proc.waitFor();
- If you increase the number of dos/shell commands in the bat file then try executing it then it definately hangs at proc.waitFor();
Even "cmd.exe /C C:\\test.bat" hangs... if the commands are more...
Is this some sort of bug? or am i doing anything wrong? I tried searching for solution on the net and search forums... but couldnt find a solution for the same.. not sure where i missed, what i missed...
Incase some one finds a solution.. do post it here...
Message was edited by:
amadas -
I installed 2013 versions of
Microsoft Deployment Toolkit (MDT)
Download
Windows Assessment and Deployment Kit (ADK)
Download
I run "Employment and Imaging Tools Environment" cmd in Administrative mode.
I then run a BAT file which has a line
copype amd64 h:\WinPE_amd64
After copype runs (which says successful), it appears to have exited the BAT file and not continued to the next command line.
Why is this occurring?
Thanks in advance.I have several technical reasons that I need to use a BAT file containing a "copype" command
line along with other lines of commands in the BAT file.
Usually, a command returns after executing and then the next command is executed in the BAT file. For some
unknown reason, when "copype" finishes executing, it causes the BAT file to exit rather
than executing the following command line. Why? -
Running .bat files as administrator on win 7 and win 2k8 machines
I have .bat which will be copied onto Win 7 and Win 2k8 machines remotely. The batch file contains scripts to stop and restart Windows services, like,
net stop "Adobe Acrobat Update Service".
Now when I run this batch file, I get "System error 5 has occurred. Access is denied."
I understand that I need to run this batch file as administrator (here by administrator I mean, Windows default administrator.).
Does anyone have a solution for this?
P.S: 1) "run as" command inside the .bat file won't work, since you need to run the .bat file itself as administrator (here by administrator I mean, Windows default administrator.).
2) I can create another batch file (say b.bat) containing the "run as" command and invoking the the original batch file (say a.bat), which has the command net stop "Adobe Acrobat Update Service". But still, this won't solve the issue, since you can run as,
the user, who has administrator privileges and not run as administrator (here by administrator I mean, Windows default administrator.) itself.Suhas,
Can you explain me why you want to do this?
Maby there are there some beter ways to achive your goal.
The reason why this doesn't work is UAC who strips the administrator tokens from your user account.
So it is not nesseary to use the default windows administrator account. Just a user with administrative priviliges will do you only need to run this command elevated.
There are several ways to run this command elevated:
Just right click on the batch file and choose the option run as administator.
Quite simple but a no go if you wanna have a fully automated solution
Use PsExec.exe from the pstools suite (avaible
here)
If you use the command like this:
PSEXEC -u domain\user -p password -h net stop spooler
PSEXEC -u domain\user -p password -h net start spooler
Or from a remote machine (pcX = remote management machine, pcY = machine where you want to restart the service.)
Execute this command on machine pcX:
PSEXEC \\pcY -u domain\user -p password -h net stop spooler
PSEXEC \\pcY -u domain\user -p password -h net start spooler
Create a sheduled task with the "highest privlilges" that executes your batch file.
etc ...
Kind Regards
DFT
IM me - TWiTTer: @DFTER -
How to execute sqlplus command in bat file ?
Hello
I have a simple script file that looks like this:
"sqlplus admin/admin as sysdba
shutdown immediate"
But.. when i start this file.bat my system logs but do not make any script. Sqlplus just waiting for command, and when i write "exit" i logout from sqlplus, and then system execute next command, that is "shutdown immediate" but beyond sqlplus (so my base is still working). Is it at all possible to log on and execute commands from file.bat or some other way ?
I'm using oracle 11g, windows 7x64
Regards and thx for help
Edited by: 879529 on 2011-11-27 04:52969970 wrote:
Thank you that worked for me.But I fear you don't really understand WHY it worked, and WHY your first attempts did not work.
So let me explain
Given this .bat file
sqlplus / as sysdba
shutdown immediateWhat happens when you execute the file? The windows command processor reads the file line by line and processes the command on each line. What is the first lilne?
sqlplus / as sysdbaSo what would you expect to happen when Windows processes that line? Remember, it's exactly as if you had entered that command yourself at the command prompt .... Answer: The OS locates an executable file named 'sqlplus', loads it into memory and passes control to it, along with a pointer to the rest of the command line ('/ as sysdba'). At that point, the executable sqlplus has control and will do whatever it wants with the command line it was passed ('/ as sysdba') and then waits for user input for more commands, including an 'exit' command. Where are those commands going to come from? They are NOT going to come from the next line in the bat file. They can't. The command processor that is running the bat file is still waiting for sqlplus to finish and return control. So you are stuck. The only way out is to break out of sqlplus with a 'ctl-break'. Once that happens, the command processor moves on to the next line in the bat file:
shutdown immediateSo now the os tries to locate an executable file named 'shutdown' .... you probably don't have an executable by that name (let's hope not!) so you then get an error message from the OS informing you that
'shutdown' is not recognized as an internal or external command,
operable program or batch file.Now, if you were using a real OS, you could achieve what you wanted by using input redirection, but unfortunately, Windows just has a toy for a command processor. -
Running from a command line with a .bat file
I am running my program through a .bat file.
The .bat file looks as follows:
java ../classes/HelloWorld
The .bat file is in a directory at the same level as classes so to get to the class file to run I specify this path. However, it cannot find the class file unless it is in the same directory as the .bat file. Is there a way around this?hi,
as you could have known from the documentation, the java virtual machine executable 'java' expects a fully qualified class name as parameter, no file path. so 'java ../classes/HelloWorld' is of course completely wrong, it should be 'java HelloWorld' and nothing else. if you want to specify a certain path where the class file is to be found, use the -classpath command line option as in 'java -classpath ../classes/ HelloWorld'.
sincerely, Michael -
How to set bat file for commands
i have to set below all commands in bat file and run in particular time.i am not able to do.please let me know how i can do
two node rac
10.2.0.4
windows
note---how to enter rac forum in this oracle forums................pls give url
echo %date% %time%
echo ############################
netstat -n
netstat -s
tracert <node1>
tracert <node2>
tracert <node3>
II
ping -t <node1>
ping -t <node2>
ping -t <node3>
Node 1: cluster node 1
Node 2 : Cluster node 2
Node 3 : Web server where the connection is failing.user1175505 wrote:
i have to set below all commands in bat file and run in particular time.i am not able to do.please let me know how i can do
two node rac
10.2.0.4
windows
note---how to enter rac forum in this oracle forums................pls give url
echo %date% %time%
echo ############################
netstat -n
netstat -s
tracert <node1>
tracert <node2>
tracert <node3>
II
ping -t <node1>
ping -t <node2>
ping -t <node3>
Node 1: cluster node 1
Node 2 : Cluster node 2
Node 3 : Web server where the connection is failing.What part do you not know how to do? You have the commands. Open up notepad and create a file containing those commands. Name the file 'whateveryouwant.cmd'. (The .bat extension is pretty much out of use, in favor of .cmd - I'm not sure of any technical difference, but I certainly know of no practical difference). Then schedule it to run using the Windows scheduler. -
Hiding the command prompt when executing bat file
Hi,
I hava a bat file which contains following
java -jar MyJar.jar
When I execute the bat file, the jar file is executed. But a command prompt also opens along with it. I dont want to display the command prompt to the user. Is there any way to hide that command prompt ?
regards,
Jatin.Is your problem solved?
If not then
insted of creating a batch file create a form file in visual basic and write following code in it
shell "java -jar MyJar.jar"
Endand then create its exe file.
It will just launch your jar file and then exit. -
Cfexecute not executing CVS commands ina bat file
We are running CF 7.0 on Windows server.
I am creating a bat file containing both DOS commands and CVS
commands.
When executing the bat file via <CFexecute> the DOS
commands execute, but the CVS commands do not.
When running the bat file from the DOS command prompt, all
commands (DOS and CVS) run as expected.
Anyone have any ideas?
ThanksOn Wed, 24 Jan 2007 23:03:48 +0000 (UTC), JRoccaforte wrote:
> That could be an issue. I am however using my login and
password in the commands
Ian didn't mean the CVS permissions, he meant the filesystem
/ OS
permissions. The a/c that ColdFusion uses to access the file
system and
other system resources is very limited, by default.
You need to login (to the OS) as the a/c CF is using, and see
if you can
execute your batch file.
Adam -
Reading the registry from a .bat file
I've searched a bit on web before asking and I apologies a head of time but my knowledge of .bat files is a little lacking. Currently I have a working .bat file I created, but was looking to adding something extra to it and just can't seem to find exactly
what I need.. What i'm looking to do is at the top of .bat file I want it to read the registry here HKEY_LOCAL_MACHINE\SOFTWARE\IS_DEPT\Simage\HW\Platform
Under Platform we either have 2 types LT or DT. (laptop or desktop)
What I want to do is at the top of my bat file have it search this key. If it has the value LT I want it to continue on with the script. If the value is DT I want it to not run the rest of the script and go to :end
If this is possible can someone provide me with the commands to put at the top of the script with also the IF commands to continue or go to :endThanks for you reply but I'm still a little lost with the reply.
What is the rest of the commands?
I understand this will query the registry, but what about searching for "LT or DT" and the IF/GOTO Commands?
reg query HKEY_LOCAL_MACHINE\SOFTWARE\IS_DEPT\Simage\HW\Platform
I think my confusion is how to define LT or DT as the variable. I keep finding %errorlevel% variable, but that seems to only define on (1) or off (0)
Here's what I have so far and I dont' think it's correct.
reg query HKEY_LOCAL_MACHINE\SOFTWARE\IS_DEPT\Simage\HW\Platform /f
if "%ERRORLEVEL%" == "LT" GOTO HOME
if "%ERRORLEVEL%" == "DT" GOTO NOOOOPE
Maybe you are looking for
-
IPod Touch 4g stuck in recovery mode after iso 5.0 upgrade attempt
Sorry that I'm late to the party and too stupid not to know better when updating my ipod touch just days after the update was released, when will I learn. I have tried nearly everything I've seen posted in this community and others ... unpluging all
-
Excise duty payable amount in words
hi kings I show the tax amount split in pld's .but our customers need to show the amount in words when Excise duty comes.but when using group the value store in single variable how i show the amount in words excise duty only Thanks & Best Regards B.L
-
Hi Please let me know about the purpose this PPOPX TABLE and how to join with ppoix and ppdit with this table. Regards Sebastian John
-
Photoshop elements 9 will not open
I recently bought photoshop elements 9 and installed it. I opened it for the first time and it worked fine. I closed it and then went to open it again. It displayed the welcome screen and I clicked 'edit' the welcome screen closed and nothing happene
-
Appearance Manager 1.0.2 or 1.0.3?
Where can I download Appearance Manager 1.0.2 or 1.0.3, transfer it from my pc to my mac? Because I found some links, but they wont expand in stuffit (in my mac (IIvx))