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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add charachers to string (newbe)

Status
Not open for further replies.
You can do it two ways. Either when you assign it:
Code:
strUser="'.\operator'"
or later:
Code:
strUser = "'.\" & strUser& "'"
Hope this helps

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Thanks,

I tried both ,nothing seems to work.
The current code is:
strUser="operator"
strUser=""'.\" & strUser& "'"
strPassword="colorserver"
strCommandLine=PPSSwitchStream

for i = 1 to Configuration '1-8'

strComputer="150.101.101." & i & "1"
str2Run=SCISYS & "\Exec\Bin\RemoteStart.wsf " & _
chr(34) & strUser & chr(34) & " " & _
chr(34) & strPassword & chr(34) & " " & _
chr(34) & strComputer & chr(34) & " " & _
chr(34) & "CMD /C %SCISYS%\Exec\Bin\StartProduct.wsf " & strCommandLine & chr(34)

res=WSHShell.Run(str2Run , 2 ,FALSE)
FReturn=ScriptLogger("Atetmpting to Remote start : " & _
chr(34) & strUser & chr(34) & " " & _
chr(34) & strPassword & chr(34) & " " & _
chr(34) & strComputer & chr(34) & " " & _
chr(34) & "%SCISYS%\Exec\Bin\StartProduct.wsf " & strCommandLine & chr(34) ,1)
next

else
FReturn=ScriptLogger("[HardwareConfigChange changed therfore avoiding RemoteStart for PPS(s)]",1)
end if


Long live king Moshiach !
 
How about:
Code:
 strUser=".\operator"

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Tip: use the Option Explicit instruction.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
[1] This line:
>[tt]strUser="[highlight]"[/highlight]'.\" & strUser& "'"[/tt]
is not what had been suggested. It is by itself a compile-time error already.

[2] Besides, I don't think you need that much chr(34) everywhere. How about inspect for yourself this?
[tt] wscript.echo str2Run[/tt]

[3] You use False (bWaitOnReturn, i.e. asynchronous) for .run method. Make sure you know what it is.
 
[4] SCISYS appears as variable and an environment variable. Make sure you get it right one way or another. If it is an environment %SCISYS%, expand it using wshshell's expandenvironmentstrings() method when inject into the command line string to make sure that part is properly done without doubt.
 
[1-amended] This line:
>[tt]strUser="[highlight]"[/highlight]'.\" & strUser& "'"[/tt]
is not what had been suggested. It is by itself a compile-time error already. It is not a compile-time error by luck because "" is followed by a single quote taken as comment thereafter. But it makes strUser an empty string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top