Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
4649
- Posts: 2
- Joined: 13 Dec 2020 03:23
#1
Post
by 4649 » 13 Dec 2020 03:27
Hi, I would like to know if this batch code is safe to run. Thank you.
Code: Select all
taskkill /f /im explorer.exe
timeout /t 2 /nobreak >nul
if not exist "%UserProfile%\Documents" mkdir "%UserProfile%\Documents"
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal" /t REG_SZ /d "C:\Users\%USERNAME%\Documents" /f
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "{f42ee2d3-909f-4907-8871-4c22fc0bf756}" /t REG_EXPAND_SZ /d %%USERPROFILE%%"\Documents" /f
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Personal" /t REG_EXPAND_SZ /d %%USERPROFILE%%"\Documents" /f
attrib +r -s -h "%USERPROFILE%\Documents" /S /D
timeout /t 1 /nobreak >nul
start explorer.exe
Last edited by
aGerman on 13 Dec 2020 13:07, edited 1 time in total.
Reason: code formatting
-
aGerman
- Expert
- Posts: 4678
- Joined: 22 Jan 2010 18:01
- Location: Germany
#2
Post
by aGerman » 13 Dec 2020 13:18
You left no word about the aim of this snippet. So nobody can tell if it is even able to do what you expect.
From what I see it doesn't seem to be malicious. However, it updates your registry settings and the behavior of the explorer shell. So I strongly suggest you to backup the keys which get changed. That way you're able to roll back if the updates aren't satisfying.
Steffen
-
4649
- Posts: 2
- Joined: 13 Dec 2020 03:23
#3
Post
by 4649 » 13 Dec 2020 15:42
Hi, thank you for replying, I downloaded this from a site to separate my documents folder and local drive after I accidentally merged them. It worked fine but I wanted to make sure the file didnt make any malicious change, that doesnt seem to be the case right?
-
aGerman
- Expert
- Posts: 4678
- Joined: 22 Jan 2010 18:01
- Location: Germany
#4
Post
by aGerman » 13 Dec 2020 16:00
As I wrote, I can't see anything that would be dangerous.
Steffen
-
isidroco
- Posts: 6
- Joined: 21 Oct 2020 08:54
#5
Post
by isidroco » 21 Dec 2020 17:32
I don't like attrib line, will make all documents read only, I would change +r to -r there.