本文介绍了相当于 %username% 用于 VB 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从当前用户的计算机中删除 OfficeFileCache 文件夹.目前我有..
I am looking to delete OfficeFileCache folder from the current user's computer. Currently I have..
Option Explicit
Dim obj : Set obj =CreateObject ("wscript.shell")
Dim fso : Set fso =CreateObject ("scripting.FileSystemObject")
obj.Run "taskkill /f /im msouc.exe.exe",0
obj.Run "taskkill /f /im msosync.exe.exe",0
fso.DeleteFolder "C:\Users\%username%\AppData\Local\Microsoft\Office\16.0\OfficeFileCache"
最后一部分是我遇到的问题.只是在 VB 脚本中寻找等效的用户名.
The last part is what I am having trouble with. Just looking for an equivalent to usernames within a VB script.
推荐答案
如有疑问,请阅读 文档:
返回环境变量的扩展值.
就你而言:
fso.DeleteFolder obj.ExpandEnvironmentStrings("C:\Users\%username%\AppData\Local\Microsoft\Office\16.0\OfficeFileCache")
这篇关于相当于 %username% 用于 VB 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!