# Command Detail - W

## wc -l

```
gc c:\temp\file.txt | measure-object | select count
```

to show the number of non-blank lines:

```
gc c:\temp\file.txt | measure-object -line
```

## whoami

This shows the user that you are logged on as:

```
[Security.Principal.WindowsIdentity]::GetCurrent() | select name
```

## whence or type

There isn't a close equivalent to the unix `whence` command, because within Powershell there isn't a PATH variable for scripts. The environment's PATH and PSMODULEPATH list the folders for windows executables and for Powershell modules.

`get-command` shows the location of the windows executable, the name of the Powershell module or the translation of the alias, as follows:

```
get-command whoami,Get-Command,invoke-sqlcmd,sserv,schtasks.exe | select name,version,source,DisplayName

Name          Version      Source                           DisplayName                      
----          -------      ------                           -----------                      
whoami.exe    10.0.17134.1 c:\windows\system32\whoami.exe                                    
Get-Command   3.0.0.0      Microsoft.PowerShell.Core                                         
Invoke-Sqlcmd 1.0          sqlps                                                             
sserv         0.0          WindowsStuff                     sserv -> show-nonstandardservices
schtasks.exe  10.0.17134.1 c:\windows\system32\schtasks.exe
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devops-collective-inc.gitbook.io/a-unix-person-s-guide-to-powershell/commands-detail-w.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
