I am creating a script and I need to run exe file and a command at the same time. What am I doing wrong?
CD C:\Program Files (x86)\Jenkins\
START cmd.exe /T /C "jenkins.exe start"
The command line needs to be exactly as the following, otherwise it does not work:
C:\Program Files (x86)\Jenkins>jenkins.exe start
Thanks!
I don't quiet understand what you mean by saying you wan't to run an exe and a command at the same time. But if you wan't to start the jenkins.exe from your batch file, you can achieve this as follows:
cd "C:\Program Files (x86)\Jenkins\"
jenkins.exe start
alternatively, if you don't want the terminal to stay open as long as jenkins is running, you can use the following:
cd "C:\Program Files (x86)\Jenkins\"
start jenkins.exe start
Related
Currently am executing a program from command prompt, basically a Python command, but I want that to be automated so that the program runs the latest version of the files before the program starts.
So current program is run by saying:
python c:\program\mysoftwareUI.py
mysoftwareUI.py is present in folder that constantly is provided with updates
Now I want to write a batch file with the above command but before that also SVN command that updates the folder before the actual program is run.
How can I do this?
Create a .bat file script and place it into a directory that is in the PATH variable or the current working directory.
=== doit.bat
#ECHO OFF
PUSHD "c:\program"
svn up
python c:\program\mysoftwareUI.py
POPD
EXIT /B
When I start a batch file from another batch file, it just opens a new CMD window named just "TEST.bat", and doesn't run the actual batch. Running it manually works fine.
cd %~dp0\Colours\TEST.bat
start "TEST.bat"
I have tried many different ways to run the batch, but it all does the same thing. I've also tried to run the batch as administrator but same result again.
Full code(not finished): http://pastebin.com/GE8yJP0J
To run another batch file, use call not start. Also: cd expects a directory, not a filename.
cd "%~dp0\Colours"
call TEST.bat
I want to run .exe files from a folder using batch file, here assume that I have n number of .exe files, so on one click I want to execute all .exe files without specifying each .exe file in the batch.
for %%a in ("c:\somewhere\*.exe") do start "" "%%~fa"
For each file in the indicated set, execute it.
See for /? to get help on the command usage.
I have a command prompt shortcut that run a bat file when it's launched. Once it is launched I will issue another command,say my_command, which is added as doskey macro in login.bat
The flow is somewhat like this.
I have a cmd shortcut with target set as:
C:\Windows\System32\cmd.exe /k "D:\\login.bat"
where login.bat sets the environment.
Once the cmd prompt is active I should issue another command, say my_command (which should be run in the currently open cmd prompt)
Inside login.bat I have the following lines
...
doskey my_command=another_login.bat DEBUG 32
I was trying to write a bat file to do the whole thing.
I am not supposed to change login.bat
What I tried is :
start C:\Windows\System32\cmd.exe /k "D:\\login.bat"
my_command
The command my_command gets run on the bat file's command prompt.
How do I make the command my_commnad run on the newly opened command prompt and not in the bat file's cmd prompt?
Try this:
start C:\Windows\System32\cmd.exe /k "D:\\login.bat & devenv"
Answering your edit: bad news.
You cannot run a Doskey macro from a batch file.
Reference: http://ss64.com/nt/doskey.html
Can you just directly run the command you are setting up with doskey?
start C:\Windows\System32\cmd.exe /k "D:\\login.bat & another_login.bat DEBUG 32"
You need to specify the full path to devenv inside the batch file, and that path will depend on your version of Visual Studio.
Try replacing devenv with one of these:
VS 2013:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe
VS 2012:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe
VS 2010:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
Edit in response to your comment
The doskey.exe executable is located in C:\Windows\System32\doskey.exe. Referencing it by full path should work.
I have a exe file created via IExpress. This file contains 1 msi file, 1 setup.exe file and a batch file with those commands:
C:\Windows\System32\msiexec.exe /i pitming.msi /passive
setup.exe
When I manually launch the batch, everything runs fine. But once I put everithing in the exe, nothing happen. So I'm trying to find what is wrong, but I don't know where to find a log file containning the error.
Can someone help ?
Thx,
If you want the log out of the MSI you need to edit the line to:
C:\Windows\System32\msiexec.exe /i pitming.msi /passive /l*v %temp%\pitming.log
and you'll at least get some logging out of it.
What command are you using to launch the batch file? You might find that you need to make the post install command to be:
C:\Windows\System32\cmd.exe /c mybatchfile.bat
As far as the setup.exe goes, that probably has its own logging options.