码迷,mamicode.com
首页 > 编程语言 > 详细

python查看指定文件的属性

时间:2014-10-04 18:58:46      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:blog   http   os   ar   文件   sp   2014   c   on   

import time

import ctypes

import ctypes.wintypes

 

SEE_MASK_NOCLOSEPROCESS = 0x00000040

SEE_MASK_INVOKEIDLIST = 0x0000000C

 

class SHELLEXECUTEINFO(ctypes.Structure):

    _fields_ = (

        ("cbSize",ctypes.wintypes.DWORD),

        ("fMask",ctypes.c_ulong),

        ("hwnd",ctypes.wintypes.HANDLE),

        ("lpVerb",ctypes.c_char_p),

        ("lpFile",ctypes.c_char_p),

        ("lpParameters",ctypes.c_char_p),

        ("lpDirectory",ctypes.c_char_p),

        ("nShow",ctypes.c_int),

        ("hInstApp",ctypes.wintypes.HINSTANCE),

        ("lpIDList",ctypes.c_void_p),

        ("lpClass",ctypes.c_char_p),

        ("hKeyClass",ctypes.wintypes.HKEY),

        ("dwHotKey",ctypes.wintypes.DWORD),

        ("hIconOrMonitor",ctypes.wintypes.HANDLE),

        ("hProcess",ctypes.wintypes.HANDLE),

    )

 

ShellExecuteEx = ctypes.windll.shell32.ShellExecuteEx

ShellExecuteEx.restype = ctypes.wintypes.BOOL

 

sei = SHELLEXECUTEINFO()

sei.cbSize = ctypes.sizeof(sei)

sei.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_INVOKEIDLIST

sei.lpVerb = "properties"

sei.lpFile = "test.txt"

sei.nShow = 1

ShellExecuteEx(ctypes.byref(sei))

time.sleep(5)

 如图:bubuko.com,布布扣

python查看指定文件的属性

标签:blog   http   os   ar   文件   sp   2014   c   on   

原文地址:http://www.cnblogs.com/mhxy13867806343/p/4006096.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!