Post

Bat files for windows tasks

Hide Folders, Open Current folder in VS Code

Overview

  • This post has all bat files that I use on my regular basis
  • If you don’t know about what is bat files then read this post first.

Bat File to Hide/Unhide folders

  • This is very simple to script to hide your folders from another user who don’t know this trick
  • So, when you run this script for first time it will automatically generate new folder named Secure
  • you can put your files into this folder to hide
  • run this script again and it will hide this Secure folder
  • run this for third time to unhide Secure folder
  • Use cases
    • for office user to hide your project files or personal notes from your colleagues
    • for students who shares his/her computer with family or friends

When you rename your folder Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}, windows will scan it as control panel item and hide it. that is why you won’t be able to see that folder in windows explorer. you have to change its folder name again using command line to make it visible to windows explorer

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
@ECHO OFF

:: Unhide folder if it exists
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" (
    attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
    ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Secure
    goto End
)

:: Create Secure folder if it doesn't exist
if NOT EXIST Secure (
    md Secure
    goto End
)

:: Hide Secure folder
ren Secure "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked

:End

Open Current folder in Visual Studio Code

  • This is single line script for Visual Studio Code users
  • This script will open active folder in visual studio code
  • I have this file added to all of my VBA or python projects with version control

Make sure to copy that . at end

1
start "" "C:\Users\Ryzen2600x\AppData\Local\Programs\Microsoft VS Code\Code.exe" .
This post is licensed under CC BY-NC-ND 4.0 by the author.