![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | Encountered end of line while processing a string token I don't want to share the entire code because it is from Bruce Payette's upcoming book. I'd had a hard time copy and paste the code. Without sharing the whole code, does this provide any insight as to what is wrong? PS C:\> .\psa1.ps1 Encountered end of line while processing a string token. At C:\psa1.ps1:5 char:5 + @" <<<< PS C:\> gc psa1.ps1|select-object -first 10 param($port=80) [void][reflection.Assembly]::LoadWithPartialName("System.Net.Sockets") function html ($content,$title = "Sample Page") { @" <html> <head> <title>$title</title> </head> <body> Since it is a function, I guess the error could also be anywhere near where the function is called? |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Encountered end of line while processing a string token > PS C:\> .\psa1.ps1 > Encountered end of line while processing a string token. > At C:\psa1.ps1:5 char:5 > + @" <<<< non-ASCII probably... Loaded the file with DOS/edit. I'm still having problems though: PS C:\> .\psa1.ps1 Incomplete 'here string' token. At C:\psa1.ps1:5 char:5 + @" <<<< What's the trick to really see the content of a file and be able to pick out non-ASCII? I tried this while 'grasping at straws': gc psa1.ps1|out-file -encoding ascii psa2.ps1 |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Encountered end of line while processing a string token @" and "@ and really cool in that everything between its treated totally as literal. regardless of how many " ' ` or any other special character... but its quite pedantic in that @" and "@ have to EACH BE ON THEIR OWN LINE WITH NOTHING ELSE, or it will error out.... so with that being the case @" hello "@ will work, while the following 3 will not work @"hello"@ @"hello "@ @" hello"@ so Marco, what company do you work for? Karl |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Encountered end of line while processing a string token <klumsy@gmail.com> wrote in message news:1163573134.336422.83700@b28g2000cwb.googlegroups.com... > @" and "@ and really cool in that everything between its treated > totally as literal. regardless of how many " ' ` or any other special > character... but its quite pedantic in that @" and "@ have to EACH BE > ON THEIR OWN LINE WITH NOTHING ELSE, or it will error out.... so with > that being the case There still must be some non-ASCII in my code damn it! Maybe if I view the file in UNIX or something! Even my ouput error seems to have non-ASCII in it, and I can't strip it! > so Marco, what company do you work for? I'm assuming klumsy@gmail isn't valid... I'd prefer not to post this here unless I was trying to promote something. You can ask me at marcoDOTshaw@ZZZgmailDOTcom. ;-) |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: Encountered end of line while processing a string token On Wed, 15 Nov 2006 01:15:57 -0400, "Marco Shaw" <marco@Znbnet.nb.ca> wrote: >I don't want to share the entire code because it is from Bruce Payette's >upcoming book. > >I'd had a hard time copy and paste the code. Without sharing the whole >code, does this provide any insight as to what is wrong? > >PS C:\> .\psa1.ps1 >Encountered end of line while processing a string token. >At C:\psa1.ps1:5 char:5 >+ @" <<<< >PS C:\> gc psa1.ps1|select-object -first 10 >param($port=80) >[void][reflection.Assembly]::LoadWithPartialName("System.Net.Sockets") >function html ($content,$title = "Sample Page") >{ > @" Marco, Try it after deleting all the whitespace characters before @" on line 5. Andrew Watt MVP |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: Encountered end of line while processing a string token Marco, Given the source of the code, perhaps it would be worth also posting the question at http://www.manning-sandbox.com/forum.jspa?forumID=248 Andrew Watt MVP On Wed, 15 Nov 2006 01:15:57 -0400, "Marco Shaw" <marco@Znbnet.nb.ca> wrote: >I don't want to share the entire code because it is from Bruce Payette's >upcoming book. > >I'd had a hard time copy and paste the code. Without sharing the whole >code, does this provide any insight as to what is wrong? > >PS C:\> .\psa1.ps1 >Encountered end of line while processing a string token. >At C:\psa1.ps1:5 char:5 >+ @" <<<< >PS C:\> gc psa1.ps1|select-object -first 10 >param($port=80) >[void][reflection.Assembly]::LoadWithPartialName("System.Net.Sockets") >function html ($content,$title = "Sample Page") >{ > @" > <html> > <head> > <title>$title</title> > </head> > <body> > >Since it is a function, I guess the error could also be anywhere near where >the function is called? |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Converting Get-ChildItems to string for processing. | PowerShell | |||
| do something for each token in a line separated by comma | PowerShell | |||
| end of line while processing a string token issue | PowerShell | |||
| Search for string in CSV and delete line if string found in line | PowerShell | |||
| are there tutorial on string processing with power-shell? | PowerShell | |||