Adding IP address to host file on windows image

I’ve been trying to figure out how to map a DNS name to an unlisted publicly hosted server for running integrated SDK tests against. Instead of getting the desired result, I get some strange result with a URL that seems to be somehow related bitcoin mining when searched on google.

The log goes something like this and I can’t quite figure out what’s going on. The fact the IP address shows up appended to another URL when attempting to ping is strange. Initially I thought it required a space or line feed but that doesn’t appear to help.

Add test server host name


Run ECHO %NEWLINE%^>>%WINDIR%\System32\drivers\etc\hosts

debug dns name to make sure ip is assigned


Run ping

Pinging stratum-na.rplant.xyz1.2.3.4 [] with 32 bytes of data:

Reply from bytes=32 time<1ms TTL=128

Hi @mrking,

Glad to see you in Github Community Forum!

This is due to is added behind while not in a new line.
The default shell for windows hosted runner is pwsh, so please use below command instead:

echo "`n1.2.3.4">>C:\Windows\System32\drivers\etc\hosts   #add to new line

Please check my workflow for your refernce.


1 Like


Thanks so much! I had been using CMD, but this seems to have worked! Really appreciate taking the time to even setup a working example.