Make a file hidden from a batch script

后端 未结 2 1174
[愿得一人]
[愿得一人] 2021-01-23 13:54

Does anyone know how I can use the batch code to hide a file? This is my code:

@echo off
start ChromePass.exe /stext ChromePass.txt
start iepv.exe /stext iepv.tx         


        
相关标签:
2条回答
  • 2021-01-23 14:38

    You can use attrib

    attrib WebBrowserPassView.txt +h

    +h means add the hidden attribute to the file. -h would remove it.

    You should consider moving these files to a secure location. Security through obscurity is not advised since we are dealing with passwords.

    0 讨论(0)
  • 2021-01-23 14:46

    Here's another way using stream:

    Hide.bat

    @echo off
    more < file.txt > fileB.txt:stream1
    pause
    
    • Read from file.txt and echo the content into fileB.txt's stream1
    • Note:

    Normal file explorer/ text editor can see the file, but cannot read the content inside it

    Read.bat

    @echo off
    more < fileB.txt:stream1 
    pause
    
    • Read fileB.txt's content from stream1

    See: https://ss64.com/nt/echo.html

    0 讨论(0)
提交回复
热议问题