I need to be able to use a batch file to create another batch file with multiple lines of code. i have used the
cd C:\Documents and Settings
echo set /a var1=12 >newfile.bat
this gives me a new .bat file called newfile.bat with "set /a var1=12" inside but i need to define more than one variable in my newfile.bat.
How do i do this?
Creating a batch file with multiple lines using a batch file
Moderator: DosItHelp
-
- Posts: 2
- Joined: 05 Feb 2012 02:47
Re: Creating a batch file with multiple lines using a batch
'
[edit] forgot to escape ^!
[edit] forgot to escape ^!
Code: Select all
@echo off
>newfile.bat (
echo.set /a var1=12
echo.set /a var1=12
echo.set /a var1=12
echo.set /a var1=12
)
>>newfile.bat echo.append
type newfile.bat
pause
Code: Select all
@echo off &setlocal enableDelayedExpansion
>newfile.bat (
echo.!"!<&&||> special characters must be quoted ^! <&&||>!"!
echo.!"!<&&||> special characters must be quoted ^! <&&||>!"!
echo.!"!<&&||> special characters must be quoted ^! <&&||>!"!
echo.!"!<&&||> special characters must be quoted ^! <&&||>!"!
)
type newfile.bat
pause
-
- Posts: 2
- Joined: 05 Feb 2012 02:47
Re: Creating a batch file with multiple lines using a batch
Thanks that worked great!