Posts

Showing posts with the label Batch

How to pass arguments into a batch file

The batch file is echo %1 echo %2 Save this file as arguments.bat . In the command line we can type this command arguments.bat arg1 arg2 . It will output arg1 arg2 Reference http://stackoverflow.com/questions/26551/how-to-pass-command-line-parameters-to-a-batch-file

How to get the output of a command using batch script

@ECHO OFF IF NOT "%1"=="" GOTO ADDV SET VAR= FOR /F %%I IN ('DIR *.TXT /B /O:D') DO CALL %0 %%I SET VAR GOTO END :ADDV SET VAR=%VAR%!%1 :END Reference  http://stackoverflow.com/questions/108439/how-do-i-get-the-result-of-a-command-in-a-variable-in-windows

How to write variable to a file using batch script

echo %PATH%>path.txt Reference http://www.computerhope.com/forum/index.php?topic=105873.0

How to set the path of a batch script as a start directory

cd /d %~dp0 Set StartInDirectory=%CD% Reference http://stackoverflow.com/questions/3827567/how-to-get-the-path-of-the-batch-script-in-windows