Im trying to make a SendTo shortcut to a folder whose name changes daily to the current date in the format dd.mm.yyyy . Is there a way to put the current date in the folder path? I have no knowledge of programming
Asked
Active
Viewed 110 times
1 Answers
0
Try this:
set mydate=%date:~3,2%%date:~0,2%%date:~6,4%
echo %mydate%
Then you can put %mydate%
into the folder path
If not get the expected result:
ehco
%date%
first // in my case I got 01/24/18then compose
%mydate%
based on the vaule of%date%
such as I got 24.01.2018 with the following
set mydate=%date:~3,2%.%date:~0,2%.20%date:~6,4%
I put the following code into a file test.bat
and used (dbl click) it to:
create file
blank.txt
in current foldercreate new folder with
%mydate%
(24.01.2018
)create a file
blank.txt
in the new folder
echo off
set mydate=%date:~3,2%.%date:~0,2%.20%date:~6,4%
mkdir %mydate%
echo .> dblank.txt
cd %mydate%
echo .> dblank.txt

ild flue
- 1,323
- 8
- 9
-
Try echo `%date%` first, and compose `%mydate%` based on the value of `%date%` (01/24/18 in my case). In my test I got `24012018` with the code shown. – ild flue Jan 24 '18 at 12:39
-
if id only understand those numbers id tweak them, could i add the dot separator too? – Marian Diam Jan 24 '18 at 12:41
-
I tried, yes, dot can be added in between, got: 24.01.2018 `set mydate=%date:~3,2%.%date:~0,2%.20%date:~6,4%` – ild flue Jan 24 '18 at 12:52
-
thats exactly what i need too. ill try tweaking the numbers – Marian Diam Jan 24 '18 at 12:57
-
i figured it out to be %date:~7,2%-%date:~4,2%-%date:~10,4% in my case. however, dialog still says that path doesnt exist. should i be saving this code somewhere? ive been using it in cmd – Marian Diam Jan 24 '18 at 13:20
-
That works marvelous. But i need to use my %mydate% in the shortcut like this d:\folder1\%mydate%\ can this be achieved? – Marian Diam Jan 24 '18 at 14:12
-
Tested, yes, e.g. `echo .> %mydate%\dblank.txt` to create a new file in the new folder directly – ild flue Jan 24 '18 at 14:19
-
I work with organazing alot of files into folders and its a pain because they keep changing names by current dates. so i figured if i could right click my file and send to> the folders i need based on their path. however when creating a shortcut in windows GUI, in the SendTo folder, to that specific folder, i cant use %mydate% because windows doesnt recognize it as a destination even though my folders are in place and i run the bat file. I dont have admin rights on my work PC if that is an issue – Marian Diam Jan 24 '18 at 14:29
-
Just to drop some light. I resolved my issue with the setx command! whatever i set in cmd doesnt reset after cmd session end. Thanks so much for all the help! – Marian Diam Jan 24 '18 at 20:19
-
Very glad of hearing that! – ild flue Jan 24 '18 at 20:21