Remove Icons of exe Files automatically using jenkins

Question:

I have to change the icons of exe files for some project related work. i know there is a tool called resource hacker is used to remove icons but i need to automate this process(because more exe files). I have automated this process using python but it was a GUI automation and it was not working in Jenkins. I need to automate with scripts which should work with jenkins. is there any python library to remove icons from exe files or How we can automate in jenkins.

Here is the python code which was working locally but not in jenkins.
the exe files.txt mentioned in the code is containing the list of exe files to be changed.

import time , os , pyautogui
os.startfile(u'"C:Program Files (x86)Resource HackerResourceHacker.exe"')
time.sleep(1)
directory=r"D:Downloads"
with open('exe files.txt') as x:   
    exe = [line.strip() for line in x]
for i in range(len(exe)):
    pyautogui.hotkey('ctrl', 'o')
    time.sleep(1)
    pyautogui.write(directory +'\'+ exe[i])
    pyautogui.press('enter')
    time.sleep(1)
    pyautogui.press('delete')
    pyautogui.press('enter')
    pyautogui.hotkey('ctrl','s')
b=[]
for i in range(len(exe)):
    a=exe[i].split('.')
    b.append(a[0] + "_original." + a[1])
for i in range(len(b)):
    os.remove(directory +'\'+b[i])
Asked By: Solution_finder

||

Answers:

Use resource hacker as a headless version like this:

rh.exe -open source.exe -save save.exe -action delete -mask ICONGROUP
Answered By: Solution_finder