Adding date and time to directory name using a batch file

March 29, 2018 at 11:44:47
Specs: Windows CE
I am trying to use MD in a batch file to create a new directory name that contains the date and time in Windows Embedded CE 6.0. Is this possible and if so how? Thank you in advance for any help.

See More: Adding date and time to directory name using a batch file

Report •

#1
March 29, 2018 at 12:36:00
You may need to wring out some prohibited chars.
Run this and post result:

@echo on > ### & dir ###

=====================

M2 Get custom script or take private lessons


Report •

#2
April 2, 2018 at 12:41:19
This seems to have become the CN norm.

The very few requests which make any sense promptly get abandoned.

=====================

M2 Get custom script or take private lessons


Report •

#3
April 2, 2018 at 15:34:16
or family easter weekend ;)

this should work, altho not tested yet

mkdir "%time%-%date%"

i5-6600K[delid]@4.8GHz/4.5GHz@1.385v | 2x4GB Crucial-DDR4-2133@14-14-14-30 1T 2666MHz@1.35v
ASUS Z170K | Samsung 250GB SSD 850 EVO
MSI Armor RX 570 4GB@1355/1940 BiosMod

message edited by hidde663


Report •

Related Solutions

#4
April 4, 2018 at 07:50:06
Yes, sorry I was on vacation.

Pocket CMD v 6.00
\> REM @echo off

Directory of \

04/04/18 10:05a 0 ###

Found 1 file(s). Total size 0 bytes.
1 Dir(s) 44209152 bytes free

\>
\>
Cannot execute SETLOCAL.exe.
\>
\> set hh+%time:~0,2%
\> if "%time:~0,1%"==" " set hh=0%hh:~1,1%
\> set dt=%date:~4,2%-%date:~7,2%-%date:~10,4%_%hh:0,2%_%time:~3,2%_%time:~6,2%

\>
\>md "\USB Storage\BMW-1_%dt%"
MD: failed to create \USB Storage\BMW-1_%date:~4,2%-%date:~7,2%-%date:~10,4%_%hh:0,2%_%time:~3,2%_%time:~6,2%
\>
\> copy "\windows\logs\BMW_1_HMI_February_16_2018\M_Alarms\*.*" "USB Storage\BMW-1_%dt%"
\windows\logs\BMW_1_HMI_February_16_2018\M_Alarms\*.*: File not found.
\>
\> Ping localhost -n 15 >NUL

hidde663 I'll try your method shortly. Some of the code above I copied from a page I found to format the date and time correctly. It works perfect on my desktop running Windows 7, but not on CE.

Thanks again for the help.


Report •

#5
April 4, 2018 at 21:48:06
I suppose this:
////////////////////////////////////////////////////////////////////////////
Directory of \
04/04/18 10:05a 0 ###
Found 1 file(s). Total size 0 bytes.
1 Dir(s) 44209152 bytes free
////////////////////////////////////////////////////////////////////////
Is the output of what I posted.

Where this and the rest figure in is anybody's guess:

Cannot execute SETLOCAL.exe.

=====================

M2 Get custom script or take private lessons


Report •

#6
April 5, 2018 at 02:15:17
Below is the script that will run on my desktop but not on the CE based computer:

REM @echo off
@echo on > ### & dir ###

:Start

@SETLOCAL ENABLEDELAYEDEXPANSION

set hh=%time:~0,2%
if "%time:~0,1%"==" " set hh=0%hh:~1,1%
set dt=%date:~4,2%-%date:~7,2%-%date:~10,4%_%hh:~0,2%_%time:~3,2%_%time:~6,2%

md "\USB Storage\BMW-1_%dt%"

copy "\windows\logs\BMW_1_HMI_February_16_2018\M_Alarms\*.*" "\USB Storage\BMW-1_%dt%"

PING localhost -n 15 >NUL

Goto Start


Report •

#7
April 5, 2018 at 19:05:27
windows CE / pocket cmd v 6.0:
syntax etc. seems mosty foreign to me. See if there's a specialty forum for this OS, or use google to locate more relevant information.
Internal cmd.exe commands might be extracted using a binary processor or editor and some patience, but not something off-the-shelf as far as I know. I used "edit /70" to view my win-7 cmd.exe, and found the internal commands, (in Unicode of course), listed about halfway down in the file - maybe 50 items or so. Anything else is external.
Given the OS name: "pocket", obviously there will be some attenuation to allow for the limitations of a less-endowed device.

Report •

Ask Question