![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest
Posts: n/a
| 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? |
| | #2 (permalink) |
| Guest
Posts: n/a
| 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 |
| | #3 (permalink) |
| Guest
Posts: n/a
| 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 |
| | #4 (permalink) |
| Guest
Posts: n/a
| 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. ;-) |
| | #5 (permalink) |
| Guest
Posts: n/a
| 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 |
| | #6 (permalink) |
| Guest
Posts: n/a
| 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? |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Converting Get-ChildItems to string for processing. | rush | PowerShell | 3 | 02-01-2008 08:44 AM |
| do something for each token in a line separated by comma | MaxMad | PowerShell | 5 | 01-09-2008 03:00 PM |
| end of line while processing a string token issue | hectoritnt | PowerShell | 6 | 09-28-2007 01:22 PM |
| Search for string in CSV and delete line if string found in line | sherlock | PowerShell | 2 | 07-02-2007 03:42 PM |
| are there tutorial on string processing with power-shell? | light_wt | PowerShell | 10 | 05-22-2007 07:30 PM |