Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Here String Problem

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 11-16-2007   #1 (permalink)
Telos
Guest


 

Here String Problem

What is wrong with this string declaration:

[string] $LPTicketLink = @"
<td align="center" title=''
<%# ((AlertLog)Container.DataItem).Ticket =''= null='' ? "Create Ticket"
:='' "Ticket Title: " +
((LPI.SCWeb.Business.AlertLog)Container.DataItem).Ticket.Title=''%>'>
<%# ((AlertLog)Container.DataItem).Ticket =''= null='' ? "<a href=" +
Tools.ApplicationRoot + "/TroubleTickets/NewTicket.aspx?AlertLogID=" +
((AlertLog)Container.DataItem).AlertLogID + "&Title=" +
Server.UrlEncode(((AlertLog)Container.DataItem).Alert.Title) +
">&ltCreate&gt</a>" : "<a href=" + Tools.ApplicationRoot +
"/TroubleTickets/EditTicket.aspx?TicketID=" +
((LPI.SCWeb.Business.AlertLog)Container.DataItem).Ticket.TicketID + ">ID " +
((LPI.SCWeb.Business.AlertLog)Container.DataItem).Ticket.TicketID + "</a>"%>
</td>
"@

I've tried both the single quote and double quote version, but both give me
the following error:

"Encountered end of line while processing a string token."


My System SpecsSystem Spec
Old 11-16-2007   #2 (permalink)
Karl Prosser[MVP]
Guest


 

Re: Here String Problem

this is another powershell gotcha...

one of the following works and the other doesn't
$a = @"
hello
"@

$a = @"
hello
"@

whats the difference..

the space after the @"

basically with here strings.. the @" has to terminate the line

and the closing "@ has to start on a new line.. so invisible spaces kill
My System SpecsSystem Spec
Old 11-16-2007   #3 (permalink)
Telos
Guest


 

Re: Here String Problem

I checked for invisible spaces already.

I was actually wondering at one point if the line ending style could matter
(eg, CRLF vs LF)



"Karl Prosser[MVP]" wrote:
Quote:

> this is another powershell gotcha...
>
> one of the following works and the other doesn't
> $a = @"
> hello
> "@
>
> $a = @"
> hello
> "@
>
> whats the difference..
>
> the space after the @"
>
> basically with here strings.. the @" has to terminate the line
>
> and the closing "@ has to start on a new line.. so invisible spaces kill
>
My System SpecsSystem Spec
Old 11-16-2007   #4 (permalink)
Karl Prosser[MVP]
Guest


 

Re: Here String Problem

So i pasted it from your email and it works fine for me.
My System SpecsSystem Spec
Old 11-17-2007   #5 (permalink)
Jeffrey Snover[MSFT]
Guest


 

Re: Here String Problem

Ditto - Can you include it as a file?
jps

--
Jeffrey P. Snover[MSFT]
Partner Architect, Windows Server
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
"Karl Prosser[MVP]" <karl@xxxxxx_o_w_e_r_s_h_e_l_l.com> wrote in message
news:%23L%23b7ILKIHA.6108@xxxxxx
Quote:

> So i pasted it from your email and it works fine for me.
My System SpecsSystem Spec
Old 11-19-2007   #6 (permalink)
Telos
Guest


 

Re: Here String Problem

I would, but I don't see a way to...

I checked the line endings again, both in Visual Studio and in Notepad and
they seem fine, no spaces after the @" or before the "@

"Jeffrey Snover[MSFT]" wrote:
Quote:

> Ditto - Can you include it as a file?
> jps
>
> --
> Jeffrey P. Snover[MSFT]
> Partner Architect, Windows Server
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Karl Prosser[MVP]" <karl@xxxxxx_o_w_e_r_s_h_e_l_l.com> wrote in message
> news:%23L%23b7ILKIHA.6108@xxxxxx
Quote:

> > So i pasted it from your email and it works fine for me.
>
My System SpecsSystem Spec
Old 11-19-2007   #7 (permalink)
Karl Prosser[MVP]
Guest


 

Re: Here String Problem

are you using powershell v1, or the v2 CTP?
what is your OS locale, and installed version of powershell

I really have no clue, but am trying to see if we can narrow down why it
doesn't work on your system but works fine on ours..
My System SpecsSystem Spec
Old 11-19-2007   #8 (permalink)
Telos
Guest


 

Re: Here String Problem

Windows XP, English and v1.0.

"Karl Prosser[MVP]" wrote:
Quote:

> are you using powershell v1, or the v2 CTP?
> what is your OS locale, and installed version of powershell
>
> I really have no clue, but am trying to see if we can narrow down why it
> doesn't work on your system but works fine on ours..
>
My System SpecsSystem Spec
Old 11-19-2007   #9 (permalink)
Jon
Guest


 

Re: Here String Problem

Try copying + pasting it from your original message in this thread. I know
you've got a local copy, but don't use that. See if that makes a difference.

--
Jon


"Telos" <Telos@xxxxxx> wrote in message
news:1DAA6CEA-C8A9-4ABD-A282-7AFE71BA556F@xxxxxx
Quote:

> Windows XP, English and v1.0.
>
> "Karl Prosser[MVP]" wrote:
>
Quote:

>> are you using powershell v1, or the v2 CTP?
>> what is your OS locale, and installed version of powershell
>>
>> I really have no clue, but am trying to see if we can narrow down why it
>> doesn't work on your system but works fine on ours..
>>
My System SpecsSystem Spec
Old 11-20-2007   #10 (permalink)
Shay Levi
Guest


 

Re: Here String Problem

Correct me if I'm wrong, I can recall that in the past I couldn't write this
(each line starts with TAB):

$cmd = @"
'This is a temporary script to Restart a PowerShell Session
'Created $(Get-Date)
On Error Resume Next
Set oApp = CreateObject("Shell.Application")
lnk = "%ALLUSERSPROFILE%\Start Menu\Programs\Windows PowerShell 1.0"
PoSH = oShell.ExpandEnvironmentStrings(lnk)
WSCript.Sleep 1000
oApp.Namespace(PoSH).ParseName("Windows PowerShell.lnk").InvokeVerb("Open")
"@

Now when I run it, it's valid (v1.0).


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com


Quote:

> What is wrong with this string declaration:
>
> [string] $LPTicketLink = @"
> <td align="center" title=''
> <%# ((AlertLog)Container.DataItem).Ticket =''= null='' ? "Create
> Ticket"
> :='' "Ticket Title: " +
> ((LPI.SCWeb.Business.AlertLog)Container.DataItem).Ticket.Title=''%>'>
> <%# ((AlertLog)Container.DataItem).Ticket =''= null='' ? "<a href=" +
> Tools.ApplicationRoot + "/TroubleTickets/NewTicket.aspx?AlertLogID=" +
> ((AlertLog)Container.DataItem).AlertLogID + "&Title=" +
> Server.UrlEncode(((AlertLog)Container.DataItem).Alert.Title) +
> ">&ltCreate&gt</a>" : "<a href=" + Tools.ApplicationRoot +
> "/TroubleTickets/EditTicket.aspx?TicketID=" +
> ((LPI.SCWeb.Business.AlertLog)Container.DataItem).Ticket.TicketID +
> ">ID " +
> ((LPI.SCWeb.Business.AlertLog)Container.DataItem).Ticket.TicketID +
> "</a>"%>
> </td>
> "@
> I've tried both the single quote and double quote version, but both
> give me the following error:
>
> "Encountered end of line while processing a string token."
>

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
problems with $var | select-string -pattern $string -q Ben Christian PowerShell 3 02-08-2008 12:41 PM
Re: get-eventlog search string problem Brandon Shell [MVP] PowerShell 1 12-03-2007 05:17 PM
Select-String problem Keith Hill [MVP] PowerShell 3 06-17-2007 12:18 PM
String PRODUCT_NAME was not found in string table Extracampine Vista General 3 02-12-2007 06:15 AM
Problem Calling String(char[] value) constructor Keith Hill [MVP] PowerShell 4 07-17-2006 07:17 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51