Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
hendrikbez
- Posts: 20
- Joined: 11 Sep 2008 22:36
#1
Post
by hendrikbez » 12 Sep 2018 01:25
Hi
I have this code, that I got from the internet, but the date is in the wrong order, how can I change it to show DD/MMMM/YYYY.
Code: Select all
@echo off
set /p host=host Address:
set logfile=Log_%host%.log
echo Target Host = %host%
for /f "tokens=*" %%A in ('ping %host% -n 1 ') do (echo %%A && GOTO Ping)
:Ping
for /f "tokens=* skip=2" %%A in ('ping %host% -n 1 ') do (
echo %date% %time:~0,2%:%time:~3,2%:%time:~6,2% %%A
timeout 1 >NUL
GOTO Ping)
-
Aacini
- Expert
- Posts: 1914
- Joined: 06 Dec 2011 22:15
- Location: México City, México
-
Contact:
#2
Post
by Aacini » 13 Sep 2018 09:26
Perhaps if you show us what is the output of your program we could have an idea of the point that should be fixed. "the date is in the wrong order" is not a description of the problem...
-
Squashman
- Expert
- Posts: 4486
- Joined: 23 Dec 2011 13:59
#3
Post
by Squashman » 13 Sep 2018 10:50
If you want the date in a different order then substring the date variable just like you are doing with the time variable.
-
pieh-ejdsch
- Posts: 240
- Joined: 04 Mar 2014 11:14
- Location: germany
#4
Post
by pieh-ejdsch » 13 Sep 2018 10:53
in this Forum you can Search for
timestamp
Phil
-
hendrikbez
- Posts: 20
- Joined: 11 Sep 2008 22:36
#5
Post
by hendrikbez » 19 Sep 2018 02:17
Thank you, got it to work, thanks for the help and info