make coomand in Batch file

Thread Starter

prj1901

Joined Aug 12, 2015
2
what is meaning of in batch file

%MAKEDIR%\cmd\make %1 %2 %3 %4 %5 %6 %7 %8 %9

What are this numbers 1,2, 3 etc.

What mean by command line parameters? Any example?
 

DerStrom8

Joined Feb 20, 2011
2,390
Yes, the %1 %2, etc are parameters passed into the batch file. It appears that each parameter is going to be a directory that the user wants to create. This looks to be part of a larger batch file, no? Could you post the whole thing?

You call the batch file and add parameters as follows:

Code:
call <batchFileName> param1 param2 param3 param4.....
%1 would be "param1", %2 would be "param2", etc.

Matt
 

nerdegutta

Joined Dec 15, 2009
2,684
What mean by command line parameters? Any example?
A command line parameter is a variable/parameter after the executable file.

I'm on a Linux system, and the notepad program I use is called gedit. If I want to open a textfile called notes.txt with notepad. I can open a terminal window and write :
Code:
gedit notes.txt
notes.txt is in this example the parameter or %1
 

djsfantasi

Joined Apr 11, 2010
9,156
Trying to understand your example... Are you trying to create a program in C? (or some other programming language?) Also, do you understand what %MAKEDIR% is?
 

DerStrom8

Joined Feb 20, 2011
2,390
Trying to understand your example... Are you trying to create a program in C? (or some other programming language?) Also, do you understand what %MAKEDIR% is?
I think he's looking at a previously written batch file.

MAKEDIR is a variable that must have been declared and set previously, which is why I asked if there was more to the code.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,156
I think he's looking at a previously written batch file. MAKEDIR is a variable that must have been declared and set previously, which is why I asked if there was more to the code.
I agree with you. That's why I asked the TS if he understood what %MAKEDIR% is.
 

Thread Starter

prj1901

Joined Aug 12, 2015
2
Sorry, the second part of my post was more aimed at the OP, not at you. Let me add a line break to make it a bit clearer.... :p
Yes
I think he's looking at a previously written batch file.

MAKEDIR is a variable that must have been declared and set previously, which is why I asked if there was more to the code.

Hi, first Sorry for late reply.

Yes MAKEDIR is path variable.

For your reference as you asked.

[QUOTE
@echo off
rem *****************************************************************************
rem * MAKEDIR has to be set to Make root directory
rem * There MUSTN'T be any blanks between the '=' sign and the path string
rem * Example:
rem * set MAKEDIR =..\..\Make
rem *****************************************************************************

cd ..\
set MAKEDIR =..\..\..\Make

rem *****************************************************************************
rem * DO NOT EDIT ANYTHING BELOW THIS
rem *****************************************************************************

if "%MAKEDIR % "==" " goto ErrorNotSet
if not exist %MAKEDIR % goto ErrorWrongPath


set PATH_OLD=%PATH%
set PATH=%MAKEDIR %\cmd;%PATH%
set CYGWIN=nodosfilewarning

%MAKEDIR %\cmd\make %1 %2 %3 %4 %5 %6 %7 %8 %9

set PATH=%PATH_OLD%
set PATH_OLD=

goto End

:ErrorNotSet
echo ************************************************************************
echo warning: MAKEDIR has to be set to Make\cmd directory!
echo ************************************************************************
goto End

:ErrorWrongPath
echo ************************************************************************
echo warning: %MAKEDIR % does not exist
echo ************************************************************************
goto End

:End
set MAKEDIR =

[/QUOTE]

Here we pass a make command to this batch file, named exam.bat -j8 rebuild.

So from where this parameter is coming.
From make file? I did not find rebuild phony in make file also.
Actually i want to understand how this building process is happening.[/QUOTE]
 

WBahn

Joined Mar 31, 2012
29,979
The "make" command is a utility that can take a number of arguments. All the string of %1 to %9 is doing is passing up to nine arguments that were provided on the command line when the batch file was called and passing them to the call to the "make" utility. If you have fewer than nine arguments, the rest are blank. If you have more than nine, then the additional ones get lost.

The %MAKEDIR% is simply replacing that string with what MAKEDIR is currently equal to. There is a DOS command called makedir -- for make directory -- which I think let DerStrom8 a bit astray. In this case, MAKEDIR is just an environment variable that stores the root directory for the make command. The executable for the make utility is located in the "cmd" directory underneath the directory pointed to by MAKEDIR.
 

WBahn

Joined Mar 31, 2012
29,979
Nope, did not lead me astray at all. %MAKEDIR% is a variable (not a command), and I was asking where it was declared.
I was referring to the statement, "It appears that each parameter is going to be a directory that the user wants to create." What led you to this conclusion (out of curiosity)?
 

DerStrom8

Joined Feb 20, 2011
2,390
I was referring to the statement, "It appears that each parameter is going to be a directory that the user wants to create." What led you to this conclusion (out of curiosity)?
It was a complete guess, to be honest. Judging by the name, I expected the program was going to be used for creating directories, and parameters containing locations would be the most obvious. I couldn't say for sure, though, without seeing the rest of the code (which the OP eventually posted).
 

djsfantasi

Joined Apr 11, 2010
9,156
It was a complete guess, to be honest. Judging by the name, I expected the program was going to be used for creating directories, and parameters containing locations would be the most obvious. I couldn't say for sure, though, without seeing the rest of the code (which the OP eventually posted).
Makes sense when you're not familiar with the program "make".
 
Top