in case you want to redirect the output from batch file and you do use START command , and you want to redirect the output from the start command, here is the way
in YELLOW you can find the trick
start cmd /c myexe.exe -p1 param1 -p2 param2 ^> c:\temp\5.txt
enjoy
Yaniv Tzanany
This Blog is first of all memos for me!! From time to time I get exposed to new and cool stuff for developers and architects ,most of the time its a solution for a problem or tips or tricks, so, I would like to track my memos and share it with you, it can save your time and nervous, I hope you will enjoy it - by Yaniv Tzanany.
Search This Blog
Showing posts with label Batch. Show all posts
Showing posts with label Batch. Show all posts
Monday, August 29, 2016
Sunday, September 16, 2012
How to start several processes from the Windows shell and wait for them all to complete?
i found this easy solution to achieve this
main.bat
main.bat
start cmd /c proc1.bat
start cmd /c proc2.bat
:wait
sleep 1
IF NOT EXIST proc1done GOTO wait
IF NOT EXIST proc2done GOTO wait
del proc1done
del proc2done
echo All processes are complete
proc1.bat
proc1.exe
echo Done > proc1done
The sleep command is available in Windows Server 2003 Resource Kit Tools. If you don't have that, you could use a ping on localhost just to slow down that tight loop.
Thursday, June 17, 2010
Running Batch file from network location
I develop a java tester tool for our testers , and to avoid installing java run time on their machines, i create a directory in the network and copy there the java run time with my specific jars.
to make the life easier i create a batch file to run the tester tool.
hammmm , when i tried to run the batch file i get the next error on the next command cd .\java\bin,
“CMD does not support UNC paths as current directories“.
i solved it by the next command: "pushd %~dp0\java\bin"
the %~dp0 is to Get the Directory Path of an executing Batch file
dont forget in the end use POPD command .
i have put all the stuff on the network e.g. \\server1\tester\
so finally my batch file looks like this :
@ECHO OFF
pushd %~dp0\java\bin
java -DPARAM1=../../param.config -jar ../../param.jar %1
popd
pause
enjoy
Yaniv T
to make the life easier i create a batch file to run the tester tool.
hammmm , when i tried to run the batch file i get the next error on the next command cd .\java\bin,
“CMD does not support UNC paths as current directories“.
i solved it by the next command: "pushd %~dp0\java\bin"
the %~dp0 is to Get the Directory Path of an executing Batch file
dont forget in the end use POPD command .
i have put all the stuff on the network e.g. \\server1\tester\
so finally my batch file looks like this :
@ECHO OFF
pushd %~dp0\java\bin
java -DPARAM1=../../param.config -jar ../../param.jar %1
popd
pause
enjoy
Yaniv T
Subscribe to:
Posts (Atom)