좋아, 그래서 this thread에서, 나는 일하는 것을 얻을 수 있었다. 나는 그것이 당신을 도울 것이기를 바랍니다. 출력있는 Desktop.ini 파일 여기
from ConfigParser import RawConfigParser
dict = {"Fruits":{"Apple":"Green", "Strawberry":"Red"},"Vegies":{"Carrot":"Orange"} }
# Get a config object
config = RawConfigParser()
# Read the file 'desktop.ini'
config.read(r'C:\Path\To\desktop.ini')
for section in dict.keys():
for option in dict[section]:
try:
# Read the value from section 'Fruit', option 'Apple'
currentVal = config.get(section, option)
print "Current value of " + section + " - " + option + ": " + currentVal
# If the value is not the right one
if currentVal != dict[section][option]:
print "Replacing value of " + section + " - " + option + ": " + dict[section][option]
# Then we set the value to 'Llama'
config.set(section, option, dict[section][option])
except:
print "Could not find " + section + " - " + option
# Rewrite the configuration to the .ini file
with open(r'C:\Path\To\desktop.ini', 'w') as myconfig:
config.write(myconfig)
됩니다 :
[.ShellClassInfo]
iconresource = somePath.dll,0
[Fruits]
apple = Green
strawberry = Red
[Vegies]
potatoe = Green
carrot = Orange
[RandomClassInfo]
foo = somePath.ddsll,0
여기
[.ShellClassInfo]
IconResource=somePath.dll,0
[Fruits]
Apple = Blue
Strawberry = Pink
[Vegies]
Potatoe = Green
Carrot = Orange
[RandomClassInfo]
foo = somePath.ddsll,0
내가 사용하는 스크립트입니다 : 여기
내 기본있는 Desktop.ini 파일입니다 내가 가진 유일한 문제는 옵션이 첫 글자 대문자를 잃어 버리고 있다는 것입니다.
(지금까지 찾은 유일한 사용자 지정 관련 기능은 [SHSetLocalizedName] (http://msdn.microsoft.com/en-us/library/windows/desktop/bb762250%28v=vs.85%29.aspx)입니다.)) –
안녕하세요,이 스레드는 오래되어 있지 않으므로 답변을 찾았는지 직접 물어볼 수 있습니다. 나는 현재 같은 문제에 직면하고있다. – DrHaze
@DrHaze 불행히도 저는 처음부터 desktop.ini를 사용했습니다 ... 아마도이 질문에 대한 작은 현상금은 누군가가 자신의 발견을보고하도록 동기를 부여합니다. –