Hi,
i would like to save some data into a text file, so far i have.
@cls
@:COMPUTERNAME
@set /p ComputerN=What is the Computer Name?
@set /p yn=Are you sure [y/n]?
@if "%yn%"=="" (echo Not entry) & (GOTO COMPUTERNAME)
@if /I "%yn%"=="n" (GOTO COMPUTERNAME)
@if /I "%yn%"=="y" (GOTO HAMACHIC) else (echo Invalid Entry) & (GOTO FILENAME)
@:HAMACHIC
@pause
@echo "ComputerName %ComputerN" > test.txt
@echo "AutoNetwork <BNS_VPN>" >> test.txt
@echo "AutoPassword <password>" >> test.txt
@echo "ChatColorLogBack 000000" >> test.txt
@echo "ChatColorLogFore FFFFFF" >> test.txt
@echo "ChatColorLogSelf 528B8B" >> test.txt
@echo "ChatColorLogPeer CFDBC5" >> test.txt
@echo "ChatColorLogSystem CC99CC" >> test.txt
@echo "ChatColorLogNetwork C2C2C2" >> test.txt
@echo "ChatColorLogHistory CDCDCD" >> test.txt
@echo "NoTrayBalloons 1" >> test.txt
@pause
i can't have the "" in the file, if i take them out i get errors because of >'s in the data.
Thanks
Saving input from batch into text file [Partially complete]
Moderator: DosItHelp
Re: Saving input from batch into text file [Partially complete]
bre,
You will need to escape special characters like this:
Optionally use FOR command like this:
DosItHelp?
You will need to escape special characters like this:
Code: Select all
@echo AutoNetwork ^<BNS_VPN^> >> test.txt
Optionally use FOR command like this:
Code: Select all
(for %%A in (
"ComputerName %ComputerN"
"AutoNetwork <BNS_VPN>"
"AutoPassword <password>"
"ChatColorLogBack 000000"
"ChatColorLogFore FFFFFF"
"..."
) do echo.%%~A
)>"test.txt"
DosItHelp?
Re: Saving input from batch into text file [Partially complete]
I don't understand why people use @!!!
Use a in the start of the batch file!
Much easier!
Use a
Code: Select all
@Echo off
Much easier!