Hello,
Does anybody know to to single multiple commands with results to a single line to text file in windows 10 cmd.
What I want to do is send the name of the hostname of the computer and the date
The command are Hostname & date /t >> test.file.
This command only send the date, but the Hostname. I have tried Hostname & date /t without sending the output to a file and I notice that it displays
Hostname
Date
What I want is Hostname Date in a single line then send it to the textfile as a single line not two lines.
Is this possible?
Thanks
Sending command to a single in a text file
Moderator: DosItHelp
Re: Sending command to a single in a text file
Yes, it is possible.
Code: Select all
@for /f %A in ('hostname') do @for /f "delims=" %B in ('date/t') do @echo %A %B > testfile.txt
Re: Sending command to a single in a text file
Why not....?
Code: Select all
echo %computername% %date%