batch file script need

  • I need a batch file script to read the hostname, and replace the hostname dynamicaly where we see 'Hostname' in below script.

    sqlcmd -S Hotsname\Inst -i C:\abc.sql

    can some one provide this.

  • in a bat/cmd file or command prompt, you can get the computer name from the variable %computername%

    echo %computername%

    so you can build a script with that...does that help?

    edit

    also, if the script is alwasy being run on the same server, you don't need the computername anyway...you can just use the dot placeholder to reference the current server, i think

    sqlcmd -S .\Inst -i C:\abc.sql

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks..

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply