How to change existing folder's icon via Command Line? (Windows 10)

前端 未结 2 1392
逝去的感伤
逝去的感伤 2021-01-15 06:13

I have a folder on my desktop and 12 different icons. I want to create a scheduled task with Task Scheduler that runs as long as my PC is on and changes the icon of the fold

相关标签:
2条回答
  • 2021-01-15 06:45

    I was able to make a working model here:

    Set DriveLetter=C    
    Set Pathing=test    
    Set IconPath=users\username\desktop\icon.ico    
    attrib -s -h -r %DriveLetter%:\%Pathing%\desktop.ini    
    echo [.ShellClassInfo] >%DriveLetter%:\%Pathing%\desktop.ini    
    echo IconFile=%DriveLetter%:\%IconPath%>>%DriveLetter%:\%Pathing%\desktop.ini    
    echo IconIndex=0 >>%DriveLetter%:\%Pathing%\desktop.ini    
    attrib +s +h +r %DriveLetter%:%Pathing%\desktop.ini    
    attrib +s +r %DriveLetter%:\%Pathing%    
    pause
    

    Please note the following:

    This doesn't require the need for "DriveLetter" I just like adding that to my scripts (Though having the drive letter specified is required, you just don't need the extra option it can be merged in with the path[Pathing] Option)

    DriveLetter= The drive you want it on

    Pathing= the path to the folder in question you wish to change

    Iconpath= the full path to the icon's location

    The result is I have a folder located @ E:\test\ that has the icon in question

    you should be able to run that code and get output by only editing the top 3 lines, or you could write it in manually.

    0 讨论(0)
  • 2021-01-15 07:07

    You can use below script that I found it here.

    If [%1] == [] goto :eof
    ECHO [.ShellClassInfo] >%1\desktop.in
    ECHO IconResource=C:\icon.ico,0 >>%1\desktop.in
    move %1\desktop.in %1\desktop.ini
    attrib +S +H %1\desktop.ini
    attrib +R %1
    
    0 讨论(0)
提交回复
热议问题