Question: My machine is Win7 64 bit. I use PowerShell.

While running gcc or gfortran on my PowerShell I would like to see a 'stopper' (time elapsed) during my program is execute. How can I do that in PowerShell?

I would like that this stop-watch (time elapse) will be on the shell and not part of my code that i am running. 

Is there any command? Do someone give me a script that do it (I am novice).

Answer: 
If you want the time to be constantly displayed while the script(block) is running, you can do something like below:

```
function timer($script, $interval = 1){
    $t = [system.diagnostics.stopwatch]::startnew()
    $job = start-job -script $script
    while($job.state -eq "running"){
        write-host -fore yellow "Elapsed: $($t.elapsed) "
        $job | Receive-Job
        sleep $interval
    }
    $t.stop()
}

timer -script {1..10 | %{ write-host $_ test; start-sleep 2}}

```
I am not sure I understand your requirement exactly... If you want to find the time elapsed for a powershell cmdlet or a ps1 script that you run, you can compare the startexecutiontime and endexecutiontime property of the command history.

e.g. Use get-history to find the command you want to time, then use this

```
Get-history -ID 123 | % { $_.endexecutiontime - $_.startexecutiontime}

```

or if you want to find the time elasped for the last command, use this

```
get-history -count 1 | % { $_.endexecutiontime - $_.startexecutiontime}

```