Solved Creating a batch file that makes folders?

November 14, 2011 at 09:54:13
Specs: Windows 7
i have a question very similar to this person: http://www.computing.net/answers/wi...

In his case he needs hes batch file to create a folder based on the system date. However in my situation i need it to make a folder based on the User who is logged in.

Is this possible? If so, how would i go about doing this?

ps. also it would be nice to know how to do the same based on the system time.


See More: Creating a batch file that makes folders?

Report •


#1
November 14, 2011 at 13:42:22
✔ Best Answer
md %USERNAME%

This for creating folders based on the user logged


Report •

#2
November 14, 2011 at 17:14:38
The %time% environment variable will return the current time which must be modified as the : (colon) character is used as a separator and is invalid in a directory/file name. Please test the following script which will create a directory using the current time in hhmm only.

Hope this helps.

@echo off
cls
setlocal

for /f "tokens=1-2* delims=:" %%1 in ("%time%") do (
    md %temp%\%%1%%2
)


Please come back & tell us if your problem is resolved.


Report •

#3
November 16, 2011 at 09:24:49
thanks a lot guys i really appreciate the help!

Report •

Related Solutions


Ask Question