• Text File edit with batchscript?
    8 replies, posted
What i need is for example: I know this: text>filename.txt But can i somehow make it sumtin like text>filename.txt>edit>testy (y' know what i mean) i want to spawn an edited file.\ Anyone knows?
[code]echo blah > file ${EDITOR:-vi} file[/code] That?
[QUOTE=ZeekyHBomb;43568548][code]echo blah > file ${EDITOR:-vi} file[/code] That?[/QUOTE] I was searching for dis forever O_O :D How do i make it in a new line? I am making a file that can make fun codes for ya :D In this file not to be blah but like How to spawn a .bat file with [CODE]@echo off echo test pause[/CODE]
[QUOTE=ZeekyHBomb;43568548][code]echo blah > file ${EDITOR:-vi} file[/code] That?[/QUOTE] That doesn't look like ba[B]tc[/B]h :v: You can append a line to a file using [code]echo something >> file.txt[/code], [code]echo.[/code] generates a line break. If you pipe the echo command into a different program, e.g. [code]echo.|time[/code], you can simulate the user pressing enter.
[QUOTE=Tamschi;43568696]That doesn't look like ba[B]tc[/B]h :v: You can append a line to a file using [code]echo something >> file.txt[/code], [code]echo.[/code] generates a line break. If you pipe the echo command into a different program, e.g. [code]echo.|time[/code], you can simulate the user pressing enter.[/QUOTE] Such helpfull :P Thanks!
Another thing: There are special "files" that you can write to. [code]pause>nul[/code] waits for the user to press a key without outputting text, the [I]nul[/I] file discards everything. [code]con[/code] outputs directly to the console. [URL="http://www.robvanderwoude.com/battech_redirection.php"]Here's an overview of redirecting input/output (IO) streams.[/URL]
[QUOTE=Tamschi;43568767]Another thing: There are special "files" that you can write to. [code]pause>nul[/code] waits for the user to press a key without outputting text, the [I]nul[/I] file discards everything. [code]con[/code] outputs directly to the console. [URL="http://www.robvanderwoude.com/battech_redirection.php"]Here's an overview of redirecting input/output (IO) streams.[/URL][/QUOTE] Then ill ask another thing too :P I am trying to do [CODE]echo Name of the file? set /p name= echo @echo off >> %name%.bat echo echo test >> %name%.bat echo pause >> %name%.bat[/CODE] But it doesn't go with .bat it makes a blank file, i want it to be .bat :P EDIT: Nvm fixed it :P thanks [editline]17th January 2014[/editline] Okay getting problems again, if i want to make a file with something for example %random% it turns into any numbers in that file, but i want it to be %random% not 3371 So in a file that i make with batch i want: Not 3371 But %random%
[code]echo %%random%% >> %name%.bat[/code]
[QUOTE=Dienes;43570076][code]echo %%random%% >> %name%.bat[/code][/QUOTE] It works!! Thank you so much :P
Sorry, you need to Log In to post a reply to this thread.