看来我们所有用户构建块* .dotx文件都已损坏。我需要为所有用户重命名这些文件,以便MS Word重新创建它们。这是我放在一起但它似乎不起作用。我希望它遍历每个用户appdata文件夹(存储在R:\ Usersfolders \ username中)并重命名这些文件,将OLD附加到文件名的末尾。任何帮助将不胜感激!
@echo off
for /F %Building Blocks.dotx% in(R:\UsersFolders\*username*\AppData\Roaming\Microsoft\Document Building Blocks\1033\15) do (rename "Building Blocks.dotx" "Building BlocksOLD.dotx")
for /F %Built-In Building Blocks.dotx% in (R:\UsersFolders\*username*\AppData\Roaming\Microsoft\Document Building Blocks\1033\15) do (rename "Built-In Building Blocks.dotx" "Built-In Building BlocksOLD.dotx")
pause
答案 0 :(得分:0)
你正在使用一些非常错误的东西。
ren
命令的语法。 for /f %%a in ('dir /b /ad "R:\UsersFolders"') do (
echo ren "%%~fa\AppData\Roaming\Microsoft\Document Building Blocks\1033\15\Built-In Building Blocks.dotx" "Built-In Building BlocksOLD.dotx"
)
命令无法接收文件的完整路径您的代码应该类似于:
def check(self, guess):
#compares the guess to the correct answer
print ("guess " + guess)
correct = self.problems[self.counter].correct
print ("correct " + correct)
self.btnA.config(state='disabled')
self.btnB.config(state='disabled')
self.btnC.config(state='disabled')
self.btnD.config(state='disabled')
if guess == correct:
#update ans
if guess == "A":
self.astatus["text"] = "✓"
elif guess == "B":
self.bstatus["text"] = "✓"
elif guess == "C":
self.cstatus["text"] = "✓"
else:
self.dstatus["text"] = "✓"
self.marks+=10
else:
if guess == "A":
self.astatus["text"] = "x"
elif guess == "B":
self.bstatus["text"] = "x"
elif guess == "C":
self.cstatus["text"] = "x"
else:
self.dstatus["text"] = "x"
if correct == "A":
self.btnA["fg"] = 'green'
elif correct == "B":
self.btnB["fg"] = 'green'
elif correct == "C":
self.btnC["fg"] = 'green'
else:
self.btnD["fg"] = 'green'