Help with script

  • Can someone help me with this script? I'm missing a quote, comma, or parenthesis somewhere. My instancename has been replaced with (INSTANCENAME) to protect the innocent. Thanks.....Here's the script:

    ECHO ON

    @ECHO OFF

    FOR /F "TOKENS=6 DELIMS= " %%A IN ('"%ProgramFiles%\Microsoft SQL Server\90\Tools\Binn\SQLCMD" -S "127.0.0.1\(INSTANCENAME)" -Q "SELECT @@VERSION"^| FINDSTR /I "SQL SERVER"') DO (SET SQLBUILD=%%A)

    ECHO %SQLBUILD%

    @ECHO OFF

    PAUSE

  • Thanks ME, I figured it out :p

    ECHO ON

    SET WORKINGDIRECTORY=%CD%

    ECHO %WORKINGDIRECTORY%

    CD %ProgramFiles%\Microsoft SQL Server\90\Tools\Binn

    @ECHO OFF

    FOR /F "TOKENS=6 DELIMS= " %%A IN ('SQLCMD.EXE -S "127.0.0.1\(myinstance)" -Q "SELECT @@VERSION"^| FINDSTR /I "SQL SERVER"') DO (SET SQLBUILD=%%A)

    ECHO "%SQLBUILD%"

    CD %WORKINGDIRECTORY%

    PAUSE

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

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