< Back

Get-CPathToHostsFile

Sun Jan 12, 2020 9:47 pm

NAME Get-CPathToHostsFile



SYNOPSIS

Gets the path to this computer's hosts file.





SYNTAX

Get-CPathToHostsFile [<CommonParameters>]





DESCRIPTION

This is a convenience method so you don't have to have the path to the hosts file hard-coded in your scripts.





PARAMETERS

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-CPathToHostsFile



Returns `C:\\Windows\\system32\\drivers\\etc\\hosts`. Uses the environment variable to find the root to the Windows

directory.











RELATED LINKS