python to get the windows autostart list
As shown below:
#!/usr/bin/python #-*-coding:utf-8-*- import _winreg as wr # Import the built-in windows registry operations library import os from socket import * import getpass def GetStart(): key = r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run' aRegL = (None,wr.HKEY_LOCAL_MACHINE) aRegC = (None,wr.HKEY_CURRENT_USER)#() is to get the current username. startdir = (r'C:\Users'+ + () + r'\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup') startExe = {'localmachine':[],'currentuser':[]} startExe['startdir'] = startdir try: aKeyL = (aRegL,key)# Open key, return handle aKeyC = (aRegC,key) for i in range(1024): try: startExe['localmachine'].append( (aKeyL,i)) except: break #Exception is the end. Exit the loop. for i in range(1024): try: startExe['currentuser'].append( (aKeyC,i)) except: break finally: (aKeyL) (aKeyC) return startExe def main(): import sys reload(sys) ( "utf-8" ) start = GetStart() # This function returns a dictionary print 'LocalMachine'.center(50,'*') for i in start['localmachine']:# Iterate over the data in the dictionary print i print 'CurrentUser'.center(50,'*') for i in start['currentuser']: print i print 'StartUp dir'.center(50,'*') for i in start['startdir']: print i if __name__== "__main__": main()
Above this python get windows self-startup list is all I have shared with you, I hope it can give you a reference, and I hope you can support me more.
Related articles
Reads information from nii or a file i.e. outputs an image operation.
This article is mainly introduced to read nii or the information in the file that the output image operation, has a good reference value, I hope to help you. Let's follow the editor to take a look.2020-07-07Example of Python implementation of traversal operations with subscript indexes
This article introduces the Python implementation of traversal operations with subscript indexes, combined with specific examples of the form of analysis of the two kinds of traversal operations with indexes to achieve the method and the relevant operational considerations, friends can refer to the need for the following2019-05-05Summarize the advanced usage of Pyinstaller packaging
Some time ago in the production of word cloud production of small tools, directly on the command line with pyinstaller -F tools.py command package success, start the exe executable file when a variety of errors, the Today, we will share the pits stepped through, need friends can refer to the following2021-06-06Python package as exe detailed tutorials
today to introduce how to use Python packaged exe, the text has a very detailed tutorial, is learning python partners have a very good help, the need for friends can refer to the following2021-05-05Example implementation of the delete method for pandas DataFrame rows or columns
This article introduces the pandas DataFrame rows or columns of the method of deletion of the realization of the example, the text through the sample code describes the very detailed, for everyone to learn or work with a certain reference to the value of learning, the need for friends below with the editorial to learn together!2019-08-08Source code analysis of python Tornado asynchronous usage scenarios
This article introduces the python Tornado asynchronous use of the scenario source code analysis, there is a need for friends can learn from reference, I hope to be able to help, I wish you more progress, early promotion and salary increase!2023-09-09Python version of simple factory pattern
This article introduces the python version of the simple factory pattern in detail, with certain reference value, interested partners can refer to it2017-10-10opencv implementation of static gesture recognition opencv implementation of rock-paper-scissors game
This article is mainly for you to introduce in detail the opencv implementation of static gesture recognition, opencv implementation of rock-paper-scissors game, with certain reference value, interested partners can refer to a2019-01-01Example of adding and subtracting dates in Python.
This article introduces the Python date of the addition and subtraction and other operations of the example, I think it is quite good, and now share it with you, but also to give you a reference. Together follow the editor over to see it2017-08-08Introduction to anonymous functions in python basics
Hello, this article is mainly about the introduction of python anonymous function of the basics, interested students quickly take a look at it, if it helps you remember to favorites, easy to browse next time!2021-12-12