![]() So this solution does more or less resemble method #3 of the first part of this answer. It works because %~dp0, which is expanded to drive letter and path of the currently running script, will give you the UNC-path if run from a network share. MKDIR "\\%HOST%\%%G\%date:~-4,4%_%date:~-7,2%_%date:~0,2%"įollow-up #2: In order to programatically create the folder over/on a network share independent of the actual network path, this single line will suffice: MKDIR "%~dp0%date:~-4,4%_%date:~-7,2%_%date:~0,2%" OFFįOR /F "tokens=1" %%G IN ('NET VIEW \\%HOST% ^| FINDSTR Disk') DO ( Use NET VIEW \\192.168.1.100 to check the list of shares beforehand. echo off set dayDate:0,2 set monthDate:3,2 set yearDate:6,4 echo day echo month echo. What I want is to create a folder in the directory as November 2018 and inside it another folder called 27-11-2018. Im trying to use a batch script to create a folder and a subfolder with dates. If you're sure that you really want to include all shares, use the code below (needs to be put in a. Problem creating a directory with a batch file. Update/Follow-up: The general way in this situation - as asked - would be to evaluate all network shares and iterate over them. Or a bit easier, let PUSHD / POPD do the same for you: PUSHD \\192.168.1.100\01-SCHEMA Take a look at the AutoHotKey documentation to know how to set the key combinations.Assign the network share a temporary drive letter and work on that: NET USE Z: \\192.168.1.100\01-SCHEMA If you want to, you can customize the keyboard shortcut. From now on, whenever you want to open different folders at once, press the Alt + R keyboard shortcut. Run, "C:\Users\Username\Desktop\OpenFolders.bat" Change the dummy path with the actual path of the batch file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |