Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

%comspec% 1

Status
Not open for further replies.

Brycspain

IS-IT--Management
Mar 9, 2006
150
US
I create a lot of websites in my environment and would like to use a script to run my setspn commands. I can do it like this however, it defeats the purpose unless I can inject variables with input boxes or arrays.
Code:
objShell.Run("%COMSPEC% /k Echo Y| setspn.exe -A http/testsite server1", 1, True)

I would like to place a website and server variable like this but it throws unterminated string constant errors. I've tried several combinations of strings and quotes and I'm stuck.

Code:
objShell.Run("%COMSPEC% /c Echo Y| setspn.exe -A http/" & objWebsite & " " & objServer", 1, True)

I know the quotations are wrong but I can't find any examples of variables being used within a comspec statement...can someone point me in the right direction please?
 
you have an extra "

objShell.Run("%COMSPEC% /c Echo Y| setspn.exe -A http/" & objWebsite & " " & objServer[red]"[/red], 1, True)

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
That worked, thanks EB...I guess the command really needs to be within the ( ) and not within the " Since objserver was outside the quotes it didn't look right.
 
Either:
Call objShell.Run("%COMSPEC% /c Echo Y| setspn.exe -A http/" & objWebsite & " " & objServer, 1, True)

or:
objShell.Run "%COMSPEC% /c Echo Y| setspn.exe -A http/" & objWebsite & " " & objServer, 1, True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top