Windows Vista Forums
Vista Forums Home Join Vista Forums Donate 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

"@Echo" behavior in PS scripts

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 07-03-2008   #11 (permalink)
Martin Zugec
Guest


 

Re: "@Echo" behavior in PS scripts

@Echo is NOT Echo (just result of cmd, ehm, "naming" conventions).

@Echo is modifying command-echoying on and off. It means whether commands
(not their output) should be displayed or not.

What it means is whenever Prompt function is executed, it will show you not
ONLY output from that prompt, but also prompt itself.

Without command-echoying functionality, you can't easily implement full
debug log, because you only see results, but you don't see which command was
executed.

Martin

"sapienscripter" <guest@xxxxxx-email.com> wrote in message
news:41c3488b270408246c1a8a1949a2d6c2@xxxxxx-gateway.com...
Quote:

>
> The more I read this thread the more I'm not sure what you are really
> after. It seems that when using a script in PowerShell the transcript
> technique will meet your needs. Is that correct?
>
> When it comes to the interactive shell I think you still have an issue.
> Can you give a more practical example of something you would do in the
> CMD shell that you are trying to recreate in PowerShell? Something
> other than "hello world".
>
>
> --
> sapienscripter
>
> Coming Soon: 'Managing Active Directory with Windows PowerShell: TFM'
> (http://www.sapienpress.com/ad.asp)
>
> Windows PowerShell MVP
>
> 'My Blog' (http://blog.sapien.com/)
> 'FollowMe on Twitter' (http://www.twitter.com/JeffHicks)

My System SpecsSystem Spec
Old 07-03-2008   #12 (permalink)
sapienscripter's Avatar
Scripting Guru


Join Date: Jun 2008
Vista Ultimate 32bit
Syracuse, NY
 
Rep Power: 8
sapienscripter has a spectacular aura aboutsapienscripter has a spectacular aura aboutsapienscripter has a spectacular aura about
  sapienscripter is offline

Re: "@Echo" behavior in PS scripts

Here's one PowerShell way you could accomplish your goal, although it takes a little extra work while creating the script. Add a parameter like I do here to turn on the Verbose pipeline. By default it is turned off. But when turned on, the lines that begin with Write-Verbose will be written to the Verbose pipeline.

#MyScript.ps1
param ([switch]$verbose)

if ($verbose) {$VerbosePreference="Continue"}

Write-Verbose "Get-Date"
Get-Date

Write-Verbose "Get-WmiObject win32_bios"
Get-WmiObject win32_bios

Write-Verbose "Get-Service -Name spooler"
Get-Service -Name spooler

Yes, I realize it is not as simple as turning echo on or off but this technique actually gives you more control so that you can only see the commands that you want to see.
My System SpecsSystem Spec
Old 07-03-2008   #13 (permalink)
Leo Tohill
Guest


 

Re: "@Echo" behavior in PS scripts

I think that what you want is
set-psdebug -trace 1

That, in combination with start-transcript, should meet your needs.


"Martin Zugec" wrote:
Quote:

> @Echo is NOT Echo (just result of cmd, ehm, "naming" conventions).
>
> @Echo is modifying command-echoying on and off. It means whether commands
> (not their output) should be displayed or not.
>
> What it means is whenever Prompt function is executed, it will show you not
> ONLY output from that prompt, but also prompt itself.
>
> Without command-echoying functionality, you can't easily implement full
> debug log, because you only see results, but you don't see which command was
> executed.
>
> Martin
>
> "sapienscripter" <guest@xxxxxx-email.com> wrote in message
> news:41c3488b270408246c1a8a1949a2d6c2@xxxxxx-gateway.com...
Quote:

> >
> > The more I read this thread the more I'm not sure what you are really
> > after. It seems that when using a script in PowerShell the transcript
> > technique will meet your needs. Is that correct?
> >
> > When it comes to the interactive shell I think you still have an issue.
> > Can you give a more practical example of something you would do in the
> > CMD shell that you are trying to recreate in PowerShell? Something
> > other than "hello world".
> >
> >
> > --
> > sapienscripter
> >
> > Coming Soon: 'Managing Active Directory with Windows PowerShell: TFM'
> > (http://www.sapienpress.com/ad.asp)
> >
> > Windows PowerShell MVP
> >
> > 'My Blog' (http://blog.sapien.com/)
> > 'FollowMe on Twitter' (http://www.twitter.com/JeffHicks)
>
>
My System SpecsSystem Spec
Old 07-03-2008   #14 (permalink)
Martin Zugec
Guest


 

Re: "@Echo" behavior in PS scripts

Well, I was already thinking about it, but thats the worst case scenario
First I want to find out whether it is possible or not and then I will
experiment little more...

Martin


"sapienscripter" <guest@xxxxxx-email.com> wrote in message
news:1ebfaebd5c0a1f23ac7337e3f6255f98@xxxxxx-gateway.com...
Quote:

>
> Here's one PowerShell way you could accomplish your goal, although it
> takes a little extra work while creating the script. Add a parameter
> like I do here to turn on the Verbose pipeline. By default it is turned
> off. But when turned on, the lines that begin with Write-Verbose will be
> written to the Verbose pipeline.
>
> #MyScript.ps1
> param ([switch]$verbose)
>
> if ($verbose) {$VerbosePreference="Continue"}
>
> Write-Verbose "Get-Date"
> Get-Date
>
> Write-Verbose "Get-WmiObject win32_bios"
> Get-WmiObject win32_bios
>
> Write-Verbose "Get-Service -Name spooler"
> Get-Service -Name spooler
>
> Yes, I realize it is not as simple as turning echo on or off but this
> technique actually gives you more control so that you can only see the
> commands that you want to see.
>
>
> --
> sapienscripter
>
> Coming Soon: 'Managing Active Directory with Windows PowerShell: TFM'
> (http://www.sapienpress.com/ad.asp)
>
> Windows PowerShell MVP
>
> 'My Blog' (http://blog.sapien.com/)
> 'FollowMe on Twitter' (http://www.twitter.com/JeffHicks)
My System SpecsSystem Spec
Old 07-03-2008   #15 (permalink)
Martin Zugec
Guest


 

Re: "@Echo" behavior in PS scripts

Hi Leo,

we never met (and least I am not aware of), but I love you

That was exactly what I needed (and even better )

Thanks a lot

Martin

"Leo Tohill" <LeoTohill@xxxxxx> wrote in message
news:0F8EADFC-09DA-4616-9355-E908EEAA9574@xxxxxx
Quote:

>I think that what you want is
> set-psdebug -trace 1
>
> That, in combination with start-transcript, should meet your needs.
>
>
> "Martin Zugec" wrote:
>
Quote:

>> @Echo is NOT Echo (just result of cmd, ehm, "naming" conventions).
>>
>> @Echo is modifying command-echoying on and off. It means whether commands
>> (not their output) should be displayed or not.
>>
>> What it means is whenever Prompt function is executed, it will show you
>> not
>> ONLY output from that prompt, but also prompt itself.
>>
>> Without command-echoying functionality, you can't easily implement full
>> debug log, because you only see results, but you don't see which command
>> was
>> executed.
>>
>> Martin
>>
>> "sapienscripter" <guest@xxxxxx-email.com> wrote in message
>> news:41c3488b270408246c1a8a1949a2d6c2@xxxxxx-gateway.com...
Quote:

>> >
>> > The more I read this thread the more I'm not sure what you are really
>> > after. It seems that when using a script in PowerShell the transcript
>> > technique will meet your needs. Is that correct?
>> >
>> > When it comes to the interactive shell I think you still have an issue.
>> > Can you give a more practical example of something you would do in the
>> > CMD shell that you are trying to recreate in PowerShell? Something
>> > other than "hello world".
>> >
>> >
>> > --
>> > sapienscripter
>> >
>> > Coming Soon: 'Managing Active Directory with Windows PowerShell: TFM'
>> > (http://www.sapienpress.com/ad.asp)
>> >
>> > Windows PowerShell MVP
>> >
>> > 'My Blog' (http://blog.sapien.com/)
>> > 'FollowMe on Twitter' (http://www.twitter.com/JeffHicks)
>>
>>
My System SpecsSystem Spec
Old 07-03-2008   #16 (permalink)
Leo Tohill
Guest


 

Re: "@Echo" behavior in PS scripts

You get an answer, I get a feel-good. Great exchange!



"Martin Zugec" wrote:
Quote:

> Hi Leo,
>
> we never met (and least I am not aware of), but I love you
>
> That was exactly what I needed (and even better )
>
> Thanks a lot
>
> Martin
>
> "Leo Tohill" <LeoTohill@xxxxxx> wrote in message
> news:0F8EADFC-09DA-4616-9355-E908EEAA9574@xxxxxx
Quote:

> >I think that what you want is
> > set-psdebug -trace 1
> >
> > That, in combination with start-transcript, should meet your needs.
> >
> >
> > "Martin Zugec" wrote:
> >
Quote:

> >> @Echo is NOT Echo (just result of cmd, ehm, "naming" conventions).
> >>
> >> @Echo is modifying command-echoying on and off. It means whether commands
> >> (not their output) should be displayed or not.
> >>
> >> What it means is whenever Prompt function is executed, it will show you
> >> not
> >> ONLY output from that prompt, but also prompt itself.
> >>
> >> Without command-echoying functionality, you can't easily implement full
> >> debug log, because you only see results, but you don't see which command
> >> was
> >> executed.
> >>
> >> Martin
> >>
> >> "sapienscripter" <guest@xxxxxx-email.com> wrote in message
> >> news:41c3488b270408246c1a8a1949a2d6c2@xxxxxx-gateway.com...
> >> >
> >> > The more I read this thread the more I'm not sure what you are really
> >> > after. It seems that when using a script in PowerShell the transcript
> >> > technique will meet your needs. Is that correct?
> >> >
> >> > When it comes to the interactive shell I think you still have an issue.
> >> > Can you give a more practical example of something you would do in the
> >> > CMD shell that you are trying to recreate in PowerShell? Something
> >> > other than "hello world".
> >> >
> >> >
> >> > --
> >> > sapienscripter
> >> >
> >> > Coming Soon: 'Managing Active Directory with Windows PowerShell: TFM'
> >> > (http://www.sapienpress.com/ad.asp)
> >> >
> >> > Windows PowerShell MVP
> >> >
> >> > 'My Blog' (http://blog.sapien.com/)
> >> > 'FollowMe on Twitter' (http://www.twitter.com/JeffHicks)
> >>
> >>
>
> T
My System SpecsSystem Spec
Old 07-03-2008   #17 (permalink)
sapienscripter's Avatar
Scripting Guru


Join Date: Jun 2008
Vista Ultimate 32bit
Syracuse, NY
 
Rep Power: 8
sapienscripter has a spectacular aura aboutsapienscripter has a spectacular aura aboutsapienscripter has a spectacular aura about
  sapienscripter is offline

Re: "@Echo" behavior in PS scripts

Nice suggestion.
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unwanted Multiple contacts in "To","CC","BCC" of email send catago xsailer Vista mail 1 07-26-2008 08:34 AM
Vista not wotking with "My Computer" or "Control Panel", "Screen Saver" Platebanger Vista General 6 02-05-2008 08:54 AM
Incorrect behavior of GPO "Access this computer from the network" HAL Vista General 1 06-04-2007 03:21 AM
WM5 Sync with Vista "Windows Calender", "Contacts", and "Mail" Tony Vista General 1 02-16-2007 06:20 PM
"Close Lid behavior" broken Jon Davis Vista General 29 01-02-2007 02:21 PM


Update your Vista Drivers Update Your Vista Drivers Now!!

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
Page generated in 0.32555 seconds with 10 queries