Delete or replace a specific value in a file w/VBSCRIPT

Discussion in 'Scripting' started by Berry, Jul 26, 2003.

  1. Berry

    Berry Guest

    Problem:
    I have a file that specifies the portNumber=1001 that is
    line 17. I want to be able change the portNumber=xxxx
    using vbscript.
    xxxx would equal the environment varible. Not only do I
    need to change portNumber but need to read the environment
    varibale to set value in file. Any help would be
    appreciated.
     
    Berry, Jul 26, 2003
    #1
    1. Advertisements

  2. Try:

    Set WshShell = CreateObject("WScript.Shell")
    WScript.Echo WshShell.ExpandEnvironmentStrings("PORT_NUMBER")

    run "SET PORT_NUMBER=1234" prior to calling your VBScript with the above
    code, and it should echo 1234.

    I'm not certain what you mean by "I need... to read the environment varibale
    to set value in file". This above code would read environment variables if
    they are set. You'll need something else to read a file and set environment
    variables with it.

    --
    //David
    This posting is provided "AS IS" with no warranties, and confers no rights.
    //
    Problem:
    I have a file that specifies the portNumber=1001 that is
    line 17. I want to be able change the portNumber=xxxx
    using vbscript.
    xxxx would equal the environment varible. Not only do I
    need to change portNumber but need to read the environment
    varibale to set value in file. Any help would be
    appreciated.
     
    David Wang [Msft], Jul 28, 2003
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.