I've been trying to make a program (.bat which then I will convert to a .exe) which copies and run software installers to get a specific program installed on a ton of computers, but I also what to make it work with any file and making a .txt file to tell the .bat file how to execute the xcopy command...
So... I need help with reading from .txt files in a BATCH file
This is part of my code without the run and deleting thing:
@echo off
echo Running...
for /f "Delims=1" %%a in (settings.txt) do (
set settings1=%%a
)
set file_org=%settings1%
for /f "Delims=2" %%b in (settings.txt) do (
set settings2=%%b
)
set file_dest=%settings2%
echo Copying %file_org% to %file_dest% ...
xcopy /y %file_org% %file_dest% >nul
echo Copied %file_org% to %file_dest% succesfuly!
pause
And this is how the .txt file should be when correct:
F:\test
C:\Users\%username%\Desktop
The first line is the origin of the file it will copy The second line is the destination the file it will be copied to
Yes, this is ment to be run on an USB stick, in fact like I said earlier it's to transfer, run, delete an Installation program of a USB stick to make mass software installation a lot faster.
Let me tell you how the whole thing works:
- Configure the settings.txt file
- Plug the stick into a PC with the desired program and my little .bat file
- Run it!
- Continue the installation process with the program
- My software deletes the intaller
- Remove the stick from the PC (For safety don't forget to eject the USB ;) )
- Repeat this very short process on another computer
All of that saves time because you don't have to go get the Installer every time, just configure everything once and keep installing... :)
Also I like making things pretty so... don't give something me messy please... :)
Thank you and advance, Love from France, ILTP -_-