bginfo = 'https://script-downloads.itarian.com/bginfo/Bginfo.exe' config = 'https://script-downloads.itarian.com/bginfo/config.bgi' import os import subprocess import ctypes import urllib import ssl username = os.popen('echo %username%').read().strip() bg_path = 'C:\\Users\\'+username+'\\BGINFO' if os.path.exists(bg_path): pass else: os.makedirs(bg_path) class disable_file_system_redirection: _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection def __enter__(self): self.old_value = ctypes.c_long() self.success = self._disable(ctypes.byref(self.old_value)) def __exit__(self, type, value, traceback): if self.success: self._revert(self.old_value) with disable_file_system_redirection(): def download(fromURL,DownTo): download = urllib.urlretrieve(fromURL,DownTo) return "Success" def display(command): obj=subprocess.Popen(command,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) result,error=obj.communicate() if error: print(error) else: print("BGInfo will be displayed in your system....") bg = download(bginfo,bg_path+'\\BGInfo.exe') if bg == 'Success': con = download(config,bg_path+'\\config.bgi') if con == 'Success': cmd = '"'+bg_path+'\\BGInfo.exe" '+'"'+bg_path+'\\config.bgi" /timer:0 /nolicprompt /silent' display(cmd) else: print("Error occurred while downloading Config.bgi ...!") else: print("Error occurred while downloading BGInfo.exe ...!")