Page 1 of 1

help with loading an file!!

Posted: 31 Jul 2020 04:40
by rasil
hello everyone!!

so i want to make a batch file with a batch file.

the file that is going to make a batch file is called (A.bat)

the file that is going to be made is called (B.bat)

so here is the code to *A.bat*
-----------------------------------------------------------------------------------------------------
@echo off
:start
(for /f "tokens=* delims=:" %%L in ('findstr /b ::: "%~f0"') do echo %%L) >B.bat

::: @echo off
::: color f0
::: echo hello
::: pause
-------------------------------------------------------------------------------------------------------

but here is the problem see this code
::: @echo off
::: color f0
::: echo hello
::: pause

i do not want that i want the program to load that code from another file which is going to be called(Package.txt)

so for example *package.txt will have this code:
::: @echo off
::: color f0
::: echo hello
::: pause

and i just run *A.bat* and it will take the code form *package.txt* and create a batch file called *B.bat* :)

thanks for reading and have a nice day, any help would be appreciated!!! :D

Re: help with loading an file!!

Posted: 31 Jul 2020 08:40
by Squashman
So what is stopping you from reading package.txt instead of the batch file?

Re: help with loading an file!!

Posted: 31 Jul 2020 10:09
by rasil
thanks for replaying!

I just want to have a batch file and a package.txt file when i run the batch file there should be a batch file created!

Re: help with loading an file!!

Posted: 31 Jul 2020 10:16
by Squashman
So I will ask again. What is stopping you from reading package.txt instead of the batch file to get your result?

Re: help with loading an file!!

Posted: 31 Jul 2020 10:37
by rasil
so what if i have a batch file and lots of programs for it then ill just put package.txt file in the same directory and the batch file and run it then i will be able to run package.txt file inside the batch file for example:

Main.bat
Main.bat has a lot of programs written for it!

(Program1.txt)
@echo off
echo this is program1!
pause

(Program2.txt)
@echo off
echo this is program2!
pause


and what i need to do it put the program1.txt in the same folder as Main.bat and it will run what was written in program1.txt!

hope this helps you understand the situation :)