Batch File


  1. Posts : 304
    Windows 10
       #1

    Batch File


    I need a batch file to create a folder with sub folders. The sub folders will be named the current date, they will go in a folder on c drive. For example we can call the folder test and it would be in documents on c drive. Every time we run the batch file it would create a sub folder with current date.
      My Computer


  2. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #2

    Hello @zplugger,

    zplugger said:
    I need a batch file to create a folder with sub folders. The sub folders will be named the current date, they will go in a folder on c drive. For example we can call the folderTest and it would be in documents on c drive. Every time we run the batch file it would create a sub folder with current date.

    [1] You will only be able to have one sub-folder named with the current [ today's ] date in the folder Test unless you only run the code once a day.

    [2] Have you got code already?

    [3] If you have, you can amend the existing code to include the current [ today's ] date if it is only run code once a day.

    I hope this helps!
      My Computer


  3. Posts : 14,022
    Win10 Pro and Home, Win11 Pro and Home, Win7, Linux Mint
       #3

    Right, in order to have more subfolders or files you'd have to include the time in each name or have the process append a different character. The issue is basic back to days of DOS where a folder cannot have 2 or more subfolders of the exact same name and each folder cannot have 2 or more files of the exact same name.
      My Computers


  4. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #4

    Hello @zplugger,

    As Berton has suggested . . .

    Berton said:
    . . . in order to have more subfolders or files you'd have to include the time in each name or have the process append a different character.

    Here is an example . . .

    Code:
    @echo off
    cls
    echo.
    echo Date Format = %date%
    echo.
    echo dd   = %date:~0,2%
    echo mm   = %date:~3,2%
    echo yyyy = %date:~6,4%
    echo.
    echo Time Format = %time%
    echo.
    echo hh   = %time:~0,2%
    echo mm   = %time:~3,2%
    echo ss   = %time:~6,2%
    echo.
    echo The Current Date ^& Time Is =^> %date:~6,4%-%date:~3,2%-%date:~0,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%
    echo.
    pause
    Just incorporate the above into your code and add it to the end of the file name!

    I hope this helps!
      My Computer


  5. Posts : 304
    Windows 10
    Thread Starter
       #5

    Thanks
    I have got to to work OK, need to find a way to pin it to Task Bar

    Code:
    @echo offset curr_date=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%mkdir "%USERPROFILE%\My Documents\Test\%curr_date%_Snipping"
    - - - Updated - - -

    Got it, just add Explorer in front of path
      My Computer


  6. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #6

    zplugger said:
    I have got to to work OK, need to find a way to pin it to Task Bar.

    Code:
    @echo offset curr_date=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%mkdir "%USERPROFILE%\My Documents\Test\%curr_date%_Snipping"
    - - - Updated - - -

    Got it, just add Explorer in front of path.

    Please mark this thread as Solved!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:51.
Find Us




Windows 10 Forums