Call mvnw.cmd from a .bat file [duplicate] - maven

This question already has answers here:
What is the reason for "X is not recognized as an internal or external command, operable program or batch file"?
(4 answers)
Closed 2 years ago.
I am creating a container in docker using the below command.I need to use the below command from a .bat file when I execute the command from the command line it runs but does not work with the batch file.What am I doing wrong here.
Batch File
call mvnw.cmd spring-boot:build-image -Dspring-boot.build-image.imageName=service
Error:
'mvnw.cmd' is not recognized as an internal or external command,operable program or batch file.

Windows does not know where the mvnw.cmd is, either use an environment variable, with relative path, or use an absolute path, or navigate to the directory, before running the command.

Related

'swipl' is not recognized as an internal or external command, operable program or batch file

I already added the path to my system variables but still when I type swipl in the command prompt it doesn't open the program.
System Variables
When you add the path of SWIPL which is mostly found at "C:\Program Files\swipl\bin" (unless specified explicitly) to your System Variable - PATH. Then reopen you command prompt and try again.

.bat file runs other .bat file unexpectedly [duplicate]

This question already has answers here:
What's the relative order with which Windows search for executable files in PATH?
(3 answers)
Closed 3 years ago.
I created the following TcpConn.bat script that gets the information on open tcp connections from an android device, with an interval of two seconds, running in the adb shell.
:startTCP
adb shell cat /proc/net/tcp
timeout /t 2
goto startTCP
When testing this in my /dev/test/ folder the script ran as expected and gave me the expected output of sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode.
However when I moved it to my /dev/batchFiles/ folder it started running the contents of a different .bat script in that folder (called adb.bat). with the contents
cd C:\Android\sdk\platform-tools
adb logcat -s Unity PackageManager dalvikvm DEBUG
Now in my TcpConn.bat script I execute "adb shell...", which matches the name of "adb.bat" without the extension, so it seems to make a call to this.
My question is though, why would it execute that script? I don't want it to execute the script, but run the adb command
I'm not:
providing the complete filepath/filename (which would be c:/dev/batchFiles/adb.bat), nor am I using it as a string like "adb"
I'm not using call as explained here
not using start
Do batch scripts always check the directory for a file matching part of a command and run that file, even if it doesn't have an extension appended to it? If so is there a way to disable this behaviour?
I'm aware I can just rename the "adb.bat" file and be done with it. But want to know why it gets run.
The only thing i could somewhat related to this is "How to run batch script without using *.bat extension"
As long as there is a batch file in the same directory as the one you are executing then it will execute that adb.bat file because the windows command prompt will look in the current directory first in search of an executable when you tell your batch file to execute a command.
As far as a solution to your problem I would say if it is possible then change the name of your adb.bat file to something else like adbFile.bat that way you won't be calling it every time you need to call your adb tools from that specific directory.

Absolute path needed in batch file? [duplicate]

This question already has answers here:
What is the reason for "X is not recognized as an internal or external command, operable program or batch file"?
(4 answers)
What does %~dp0 mean, and how does it work?
(7 answers)
What is the reason for batch file path referenced with %~dp0 sometimes changes on changing directory?
(6 answers)
Closed 4 years ago.
I have a Windows batch file that calls the python interpreter:
python -m ...
That works. But now I have a second batch file that calls the first batch file. When I run this batch file, I get an error:
'python' is not recognized as an internal or external command,
operable program or batch file.
I don't understand why the second batch file doesn't work.
If it helps to have a concrete example, here's one:
In helloworld.py
print("Hello, world!")
In batch1.cmd
#echo off
echo About to call python...
python -m helloworld
pause
exit
In batch2.cmd
#echo off
set "path=%~dp0batch1.cmd"
start "" %path%
Output:
About to call python
'python' is not recognized as an internal or external command, operable program or batch file.
Press any key to continue . . .
You are completely breaking the system variable %path% by setting it in the batch. Now your system cannot find python anymore.
Simply change second batch to:
#echo off
set "mypath=%~dp0batch1.cmd"
start "" %mypath%
To explain the %path% variable better. It holds the path to any possible file locations to search for files to execute or open without the need to have the full path specified each time by a user. By running a command in cmd like python, it first checks the current directory where the batch started in, if python.exe is not there, it will search each semicolon seperated path in the %path% variable. When you set a new %path% variable it only knows of the newly set path and cannot find python to execute and you get the most common cmdline error on windows.
On another note, if you want to start batch1 in the same window, perhaps consider calling batch instead of starting it
call "%mypath%"

Batch script does not recognize Windows environment variable [duplicate]

This question already has answers here:
Windows Batch error: "'ping' is not recognized as an internal or external command operable program or batch file."
(3 answers)
Closed 6 years ago.
I have batch script like this, let's say test.bat. What it does is: cd into a directory path, and apply "make" commands:
set path=%SRC_PATH%
echo %path%
cd /d %path%
make clean
make all
When I run test.bat from a Windows Command Shell, I get following error despite I defined path to make.exe in Windows Environment Variable
'make.exe' is not recognized as an internal or external command,
operable program or batch file.
Note, I do not see this issue, when I use Windows command line and entered all the commands manually. Issue is only when I put the commands into a batch file.
Any pointers would be appreciated.
thanks.
You dont need to write this
set path=%SRC_PATH%
echo %path%
cd /d %path%
Just enter the path of make.exe in PATH Variable in environment variables..
PATH Variable already carries value so just add semi colon to the end enter the full folder path of make.exe(JUST FOLDER PATH)
now just calling make will work.

Command prompt issue C:\Users is not recognized as an internal or external command, operable program or batch file

My command prompt is having some issues. C:\Users is not recognized as an internal or external command, operable program or batch file. I don't know what the issue is. It was working 5 min previously when I was working in java not it will not recognize anything. The only thing that I did previous to that was to delete off my mysql data directly from the folder.
Are you trying to open the directory? in this case it would be
cd C:\Users

Resources