Thomas van Strijland
Thomas van Strijland

Reputation: 21

Create folder with Date and Userprofile name

Im trying to make a Bat file that creates a folder at a certain place with the Date in its name and the Name of the user.

Like:

"21-3-2016 Thomas"

I found something with the date but that also places the name of the day in front of it and thats what i am trying to get rid off.

Upvotes: 0

Views: 64

Answers (1)

Dennis van Gils
Dennis van Gils

Reputation: 3452

You can try something like this:

@echo off
FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a
set "FolderName=%DTS:~6,2%-%DTS:~4,2%-%DTS:~0,4% %username%"
mkdir "%FolderName%"

Upvotes: 1

Related Questions