Jump to content

Need Help Batch Programming or VBScripting


Recommended Posts

Batch Programming or VBScripting

In 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 File

127.0.0.1 localhost

After The Data

127.0.0.1 localhost

127.0.0.1 testsite.com ( Lower line )

Wrong Data

127.0.0.1 localhost127.0.0.1 testsite.com

Link to comment
Share on other sites


Hmmm, probably the original document misses a Carriage return/Line feed as last character.

Send a CR+LF before adding the data, BATCH example

ECHO. >>thedoc.ext
ECHO 127.0.0.1 testsite.com >>thedoc.ext

or maybe easier :

(ECHO.
ECHO 127.0.0.1 testsite.com
) >>thedoc.ext

jaclaz

Link to comment
Share on other sites

sorry i understand

can you please adapt it to my code?

My Code:

echo 127.0.0.1 testsite.com>> %SYSTEMROOT%\system32\drivers\etc\hosts

Thnx for concern

Edited by Ortakey
Link to comment
Share on other sites

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\etc
More HOSTS>HOSTS.bak&&(Del HOSTS&&Ren HOSTS.bak HOSTS)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...