When I enter "hostname" into the Windows Command Prompt, I get the expected hostname of the system, but I can't seem to include it in any string output, either assigned to another variable, or just as itself.
The below script outputs "Ready to copy to Server of Is this the correct location?" and all variations of using hostname seem to result in the same.
@echo off
set hostnamevar=%hostname%
set "greeting1=Ready to copy to Server of "
set "greeting2=Is this the correct location?"
set "greeting=%greeting1%%hostnamevar%%greeting2%"
echo %greeting%
pause
for /f %%A in ('hostname') do set hostname=%%A. Thehostnameprogram is not an environment variable. This is one way to run the program and set the output as a variable. Every time I see code like this I'm reminded why I use Bash, even in Windows.Server : UnKnown Address: 2001:4860:4860::8888