Announcement

Collapse
No announcement yet.

.Bat to replace a word in a .url file from a answer file

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • .Bat to replace a word in a .url file from a answer file

    I'm trying to make this bat file to edit or create a .url file and be using a answer file

    first i create the answer file (in this case one of my machines are named ANTD001)
    c:\echo %computername%>host.txt

    then i want to use this answerfile to edit or create a .url file

    [InternetShortcut]
    URL=hxxp://ANTDT001:8081/index.aspx

    is this doable?

  • #2
    Re: .Bat to replace a word in a .url file from a answer file

    Does the answer-file contain just one entry (a single host name)? and is it on line 1 in this file? then you can try this:
    Code:
    @echo off & goto:begin
    
    :writelinkfile ++ subroutine ++
    echo.[InternetShortcut]
    echo. URL=http://%host%:8081/index.aspx
    echo.
    
    
    :begin batch
    rem set "host=%computername%"
    rem PushD "%~0\..\"
    
    set /p host=<"host.txt"
    
    call:writelinkfile >"%host%.url"
    
    PopD
    goto:eof
    /Rems
    Last edited by Rems; 14th January 2014, 21:43.

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment

    Working...
    X