0

I've seen a tutorial online that explained how to change the icon of a pen drive once inserted using an autorun.inf file and a .ico file, and it worked perfectly, but I wanted to know if there's a way to choose a random file from a list of .ico files inside the pen drive.

Here's the code I'm using for the normal icon

[Autorun]
Icon=IconName.ico
Label=PENDRIVE

If this can't be directly done using the autorun.inf file, please let me know an alternative method, even if it requires other files (such as .vbs files)

Here's the website I used just in case

https://www.windowscentral.com/how-set-custom-icon-removable-drive-windows-10

nicochulo
  • 111
  • 2
  • 11
  • One way to do it would be to use the [open](https://msdn.microsoft.com/en-us/library/windows/desktop/cc144200(v=vs.85).aspx#open) command to run a shell script which chooses a random icon, and copies it to a specific file name (such as `random.ico`) each time. – jpaugh Jan 30 '18 at 16:51
  • Then, you could leave the `Icon` command set to `random.ico` permanently. That should change the icon each time you insert; it might not take effect the first time, but it should take effect each time thereafter. – jpaugh Jan 30 '18 at 16:52
  • Ok so I'm very noobie to the Autorun feature. Do I have to create a new file to do the random choosing, or will the "open" command itself do it for me? – nicochulo Jan 30 '18 at 17:04
  • As shown in the `open` link I provided above, open takes the filename of an executable to run. That executable can be written in the programming language of your choice, with the caveat that the language must installed and set up properly in the registry to be automatically recognized for files of a given type. – jpaugh Jan 30 '18 at 17:06
  • This works for batch files already, which is why I suggested it. It might even work for VBScript (which I see you use), and it can be set up for Python. – jpaugh Jan 30 '18 at 17:07
  • For example, you should be able to call python scripts with `open` after completing [these steps](https://stackoverflow.com/a/11473042/712526) (which the Python installer [*probably* did for you](https://stackoverflow.com/a/4235923/712526)). – jpaugh Jan 30 '18 at 17:13

0 Answers0