溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

WIN7如何添加云端到開始菜單

發(fā)布時間:2021-12-17 09:16:04 來源:億速云 閱讀:121 作者:小新 欄目:大數(shù)據(jù)

小編給大家分享一下WIN7如何添加云端到開始菜單,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

import re
import os
import configparser
import pythoncom
import sys
from win32com.shell import shell
from win32com.shell import shellcon

import win32com.client
objShell = win32com.client.Dispatch("WScript.Shell")
allUserProgramsMenu = objShell.SpecialFolders("AllUsersPrograms")

if len(sys.argv) < 2:
print("請輸入CloudCache路徑")
sys.exit(1)

def buildShortCut(lnkFile, name, appdir, para, workdir, showcmd):
print(lnkFile,name,appdir,para,workdir,showcmd)
shortcut = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
shortcut.SetPath(appdir)
shortcut.SetDescription(name)
shortcut.SetWorkingDirectory(workdir)
shortcut.SetArguments(para)
shortcut.QueryInterface(pythoncom.IID_IPersistFile).Save(lnkFile,0)

find_file=re.compile(r"init.ini")
find_path=sys.argv[1]
find_walk=os.walk(find_path)

shortCutDir = allUserProgramsMenu

iniFiles = []
for path,dirs,files in find_walk:
for file in files:
if find_file.search(file):
iniFilePath = os.path.join(path, file)
print(iniFilePath)
iniFileObj = open(iniFilePath)
iniContent = "rn".join(iniFileObj.readlines()[1:-1])
config = configparser.ConfigParser()
config.read_string(iniContent)
print(config.sections())

shortCutSubdir = ""
for sectionName in config.sections():
if sectionName == "Shortcut0":
shortCutSubdir = os.path.join(shortCutDir, config[sectionName]["ShortcutName"])

if sectionName.find("Shortcut") == 0:
section = config[sectionName]
packageName = config["Common"]["PacketName"]

if not os.path.exists(shortCutSubdir):
os.mkdir(shortCutSubdir)

buildShortCut(os.path.join(shortCutSubdir, section["ShortcutName"]+ ".lnk"), section["ShortCutName"],
section["AppDir"], section["Param"], section["WorkingDirectory"], 1)

以上是“WIN7如何添加云端到開始菜單”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI