WFH: Hide multiple files with bat script?

Phen8210

High Supremacy Member
Joined
Jul 29, 2011
Messages
29,030
Reaction score
8,284
Hi, anyone know where I can copy paste a bat script and then edit to hide or show multiple files at once? Need to hide some files on my desktop when I give presentation, it should work with shortcuts as well
 

LiLAsN

Master Member
Joined
Dec 14, 2008
Messages
2,697
Reaction score
509
Hi, anyone know where I can copy paste a bat script and then edit to hide or show multiple files at once? Need to hide some files on my desktop when I give presentation, it should work with shortcuts as well
Why not just press Win + tab button, then on the top left, you can see an option to create a New Desktop.
This way, you can have 2 or more 'desktops' back to back. 1 with all your shortcuts/files, and another, completely empty and devoid of your shortcuts/files. And you can easily switch between them by pressing that button above and choosing which desktop you want to switch to any time like a browser tab.
 

Phen8210

High Supremacy Member
Joined
Jul 29, 2011
Messages
29,030
Reaction score
8,284
Why not just press Win + tab button, then on the top left, you can see an option to create a New Desktop.
This way, you can have 2 or more 'desktops' back to back. 1 with all your shortcuts/files, and another, completely empty and devoid of your shortcuts/files. And you can easily switch between them by pressing that button above and choosing which desktop you want to switch to any time like a browser tab.
thanks ah, complete forgotten about this feature hahah

I tried it but it doesn't do what I need it to do.. When i create a new desktop and remove the files/shortcuts its removed from the other desktop too. It's not exhibiting independent behavior.

The new desktop feature seem to only segregate the taskbar opened programs
 

it_geek

Master Member
Joined
Feb 12, 2017
Messages
3,388
Reaction score
757
Hi, anyone know where I can copy paste a bat script and then edit to hide or show multiple files at once? Need to hide some files on my desktop when I give presentation, it should work with shortcuts as well
why don't you just...

right click on the desktop -> view -> uncheck "Show desktop icons"
 

Phen8210

High Supremacy Member
Joined
Jul 29, 2011
Messages
29,030
Reaction score
8,284
why don't you just...

right click on the desktop -> view -> uncheck "Show desktop icons"

Because I still need to access the files on my desktop, when I'm presenting of course I don't hide everything. I need to keep the ones that are relevant and hide my personal stuffs.

I am looking for something similar to a toggle switch, that lets me configure what to hide/show every time I use it.
 

it_geek

Master Member
Joined
Feb 12, 2017
Messages
3,388
Reaction score
757
because I still need to access the files in my desktop
u can still view them on file explorer when you open This PC -> Desktop

Very useful for when you flood the desktop folder with too much and you don't clean it up often.

anyway if you really want a batch script

attrib *.* +h /s /d
when you are inside the desktop folder.

to remove the hidden attribute

attrib *.* -h /s /d
 

Phen8210

High Supremacy Member
Joined
Jul 29, 2011
Messages
29,030
Reaction score
8,284
u can still view them on file explorer when you open This PC -> Desktop

Very useful for when you flood the desktop folder with too much and you don't clean it up often.

Then everybody can still see the stuff in my desktop and that defeats the purpose.
 

it_geek

Master Member
Joined
Feb 12, 2017
Messages
3,388
Reaction score
757
Then everybody can still see the stuff in my desktop and that defeats the purpose.
just updated my post. i generally try not to use this because a blanket command tends to screw things over.

if you want to censor a specific file type

attrib *.mp4 *.jpg *. mov +h /s /d

depending what kind of file types you want to censor lorh.

if you want to censor pptx files etc just replace those file types behind the *

so like *.xlsx *.pptx etc etc
 

Phen8210

High Supremacy Member
Joined
Jul 29, 2011
Messages
29,030
Reaction score
8,284
just updated my post. i generally try not to use this because a blanket command tends to screw things over.

if you want to censor a specific file type

attrib *.mp4 *.jpg *. mov +h /s /d

depending what kind of file types you want to censor lorh.

if you want to censor pptx files etc just replace those file types behind the *

so like *.xlsx *.pptx etc etc

There is not any particular file format, it is more of work files / vs personal files. So I am looking to declare them and modify the script individually. Just wonder if got any ready made ones where I can just edit?
 

Phen8210

High Supremacy Member
Joined
Jul 29, 2011
Messages
29,030
Reaction score
8,284
no... its instant. as long as you move within the same drive.

when you move within the same drive, you are telling the system file table to change the position of the index, not the physical location of the file cluster on the drive.

hence thats why its much faster.

Okay you are right, I forgotten about this logic. Then it will probably be better to just move. I also remembered I had show hidden files enable too.
 

Phen8210

High Supremacy Member
Joined
Jul 29, 2011
Messages
29,030
Reaction score
8,284
you can replace *.some file format with the exact filenames in question one after another seperated by a space. works the same.

Okay, now I'm thinking how to let it be a one click toggle behavior.

Meaning it should toggle between personal and presentation mode every time I click and move the files accordingly.

Another potential issue this probably will mess up all my icon arrangements.

Hopefully someone has an idea for this
 

peterchan75

Supremacy Member
Joined
Apr 26, 2003
Messages
6,752
Reaction score
533
But keep moving back and forth will take quite awhile no?
Here is an Excel VBA code that moves files from 1 folder to another.
Just input the full path and filename source in Column A and destination in Column B in Sheet1.

Code:
Sub move_files()

Dim fso As Object
Dim my_destination_filename As String
Dim my_source_filename As String
Dim i As Integer

Set fso = CreateObject("Scripting.FileSystemObject")
i = 1
While ThisWorkbook.Sheets("Sheet1").Cells(i, 1) <> ""
    my_source_filename = ThisWorkbook.Sheets("Sheet1").Cells(i, 1)
    my_destination_filename = ThisWorkbook.Sheets("Sheet1").Cells(i, 2)
    If Dir(my_source_filename) <> "" And my_destination_filename <> "" Then
        fso.movefile Source:=my_source_filename, Destination:=my_destination_filename
    Else
        MsgBox "File not found"
    End If
    i = i + 1
Wend

End Sub
 

it_geek

Master Member
Joined
Feb 12, 2017
Messages
3,388
Reaction score
757
Okay, now I'm thinking how to let it be a one click toggle behavior.

Meaning it should toggle between personal and presentation mode every time I click and move the files accordingly.

Another potential issue this probably will mess up all my icon arrangements.

Hopefully someone has an idea for this
u can create two batch files, one with the attrib +h (to hide files)
or attrib -h (to unhide files)

also... depending on what program u are using to share screen... isn't it better to share a specific window rather than the whole screen itself since u are so concerned about the privacy of the files on ur desktop šŸ˜…
 

Phen8210

High Supremacy Member
Joined
Jul 29, 2011
Messages
29,030
Reaction score
8,284
u can create two batch files, one with the attrib +h (to hide files)
or attrib -h (to unhide files)

also... depending on what program u are using to share screen... isn't it better to share a specific window rather than the whole screen itself since u are so concerned about the privacy of the files on ur desktop šŸ˜…

haha I thought of it too, given the nature of the work very hard la.. need to show many different files and programs.
 

it_geek

Master Member
Joined
Feb 12, 2017
Messages
3,388
Reaction score
757
i think it might be better to elaborate what exactly you are trying to hide/show... if its confidential use A and B to mask lor
haha I thought of it too, given the nature of the work very hard la.. need to show many different files and programs.
 

firesong

Supremacy Member
Deluxe Member
Joined
Jan 17, 2001
Messages
8,871
Reaction score
4,885
I just present on secondary display, and never mirror my desktop.

Far easier than trying to hide your own desktop during presentations.

There's the bonus of a presenter view on the laptop while the slides are on the projector.

This also works on Zoom/Google Meet if you have a secondary monitor plugged in - just share the secondary display.
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top