Run a command promt and run a command - batch-file

I need to write a command which is calling other command prompt of Oracle and running a command on it. Currently, I am running it using below command
D:\Oracle\setenv.bat /k BuildApp
But it only runs setenv.bat and quits and doesn't run BuildApp. BuildApp is to run on a command prompt opened by setenv.bat. Can anyone please help on this?

Try CMD /c d:\Oracle\setenv.bat /k BuildApp.

Related

How to "replace" Command Prompt in Windows 8.1?

I have a batch script in my Startup folder which begins with chcp 65001. This will crash CMD after the first command after chcp but it won't crash ConEmu.
So how do I make it run in ConEmu instead of CMD after logon?
Did you read docs?
ConEmu64.exe -run "path-to-your-batch.cmd"

How to use batch file to launch cmd silently?

I am trying to use my batch script to call upon a cmd to uninstall a program.
install -u
Is there a way which I can use my batch script to execute this cmd silently? Meaning it wont pop up.
Thanks!
start /min install -u
or if it's a command-line program
start /min cmd /c install -u

Command Prompt gets open when installing SQL Server using Power Shell

I am using the following code to setup SQL Server using Power Shell
setup.exe /CONFIGURATONFILE=config.ini
When i run the above script in power shell it opens the command prompt and runs the setup.
Is there a way in power shell that the command prompt that is being opened (which i can see on the screen) gets opened in the background.
As because of this command prompt opening i get an error "Requires an interactive shell" when i run the power shell script remotely.
Does it work if you run Setup.exe with the "Silent" mode (No user-interaction) in addition to the ConfigurationFile? Options are documented here : https://msdn.microsoft.com/en-us/library/ms144259.aspx for reference.
Try specifying /Q or /QS
E.g.
".\setup.exe /Q /ConfigurationFile=$commandlineparam"

How run file .bat as admin

I have question how run file .bat as admin? How run cmd as admin in file bat?
I must run command on cmd:
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -px "MyKey" c:\key.xml -pri
Please help and have any tips or any good material.
Use RUNAS command for this purpose like below. See help using runas /? in command prompt
runas /user:administrator "%windir%\Microsoft.NET\Framework\v2.0.5
0727\aspnet_regiis.exe -px "MyKey" d:\key.xml -pri"
Enter the password for administrator:
open start menu by pressing windows key type cmd right click cmd and select Run as administrator this will open the command prompt in administrator mode and then you can run your command as an administrator.

MSBuild PSExec hangs without error while executing batch file

As part of as our Team Build MSBuild script, we have a deployment batch file which I need to execute on a remote server:
<Exec Command="psexec -accepteula \\servername D:\Build_Drop\DeploySites.bat "/>
I can confirm it is not permissions or firewall: if the bat command is changed to run iisreset or calc.exe for example, the command will work.
I have tried -s and >nul flags, and also wrapping the batch file in a call to cmd. I have tried with and without quotes around the bat cmd.
All the options I have tried will work fine from the cmd line on the build server, but none will work from within the build script itself.
Any ideas?
Adding a -i parameter to psexec seems to have worked.
Oddly, we now get the error message:
The command "psexec -accepteula \\server -i cmd /c "D:\Build_Drop\DeploySites.bat"" exited with code 5. Please verify that you have sufficient rights to run this command.
But the command does actually work

Resources