Ortakey Posted November 12, 2008 Share Posted November 12, 2008 Batch Programming or VBScriptingIn Batch Programming and VBScripting i will input info into a document; but it adds the info to the end of the last info of the document, how can i make it put it on the lower line?Windows Hosts File Example:Original File127.0.0.1 localhostAfter The Data127.0.0.1 localhost127.0.0.1 testsite.com ( Lower line )Wrong Data127.0.0.1 localhost127.0.0.1 testsite.com Link to comment Share on other sites More sharing options...
jaclaz Posted November 12, 2008 Share Posted November 12, 2008 Hmmm, probably the original document misses a Carriage return/Line feed as last character.Send a CR+LF before adding the data, BATCH exampleECHO. >>thedoc.extECHO 127.0.0.1 testsite.com >>thedoc.extor maybe easier :(ECHO.ECHO 127.0.0.1 testsite.com) >>thedoc.extjaclaz Link to comment Share on other sites More sharing options...
Ortakey Posted November 12, 2008 Author Share Posted November 12, 2008 (edited) sorry i understandcan you please adapt it to my code?My Code:echo 127.0.0.1 testsite.com>> %SYSTEMROOT%\system32\drivers\etc\hostsThnx for concern Edited November 12, 2008 by Ortakey Link to comment Share on other sites More sharing options...
Yzöwl Posted November 12, 2008 Share Posted November 12, 2008 You shouldn't be trying to alter the output command, you should be fixing the file!Something like this should fix the file.@Echo off&Pushd %SystemRoot%\System32\drivers\etcMore HOSTS>HOSTS.bak&&(Del HOSTS&&Ren HOSTS.bak HOSTS) Link to comment Share on other sites More sharing options...
Ortakey Posted November 13, 2008 Author Share Posted November 13, 2008 Thnx Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now