How to add an entry in host file using Powershell:-
Command:-
add-content -path C:\Windows\System32\drivers\etc\hosts -value "`r`n# QA VIP for safenetgateway#
170.30.50.130 safenetgateway.int.com"
gc C:\Windows\System32\drivers\etc\hosts
$host.enternestedprompt()
Result:-
It will add # QA VIP for safenetgateway#
170.30.50.130 safenetgateway.int.com
entry to the bottom of the Host file with the new line.
gc command will fetch the details and display on console.
$host.enternestedprompt() --> Click here to see the use of this
Command:-
add-content -path C:\Windows\System32\drivers\etc\hosts -value "`r`n# QA VIP for safenetgateway#
170.30.50.130 safenetgateway.int.com"
gc C:\Windows\System32\drivers\etc\hosts
$host.enternestedprompt()
Result:-
It will add # QA VIP for safenetgateway#
170.30.50.130 safenetgateway.int.com
entry to the bottom of the Host file with the new line.
gc command will fetch the details and display on console.
$host.enternestedprompt() --> Click here to see the use of this
No comments:
Post a Comment