Equivalent %username% for VB script

喜你入骨 提交于 2019-12-01 14:37:33

When in doubt, read the documentation:

ExpandEnvironmentStrings Method

Returns an environment variable's expanded value.

In your case:

fso.DeleteFolder obj.ExpandEnvironmentStrings("C:\Users\%username%\AppData\Local\Microsoft\Office\16.0\OfficeFileCache")

If you're using some path like

C:\Users\%username%\AppData\Local\...

This is better:

%LocalAppData%\...

So

Fso.DeleteFolder Obj.ExpandEnvironmentStrings("%LocalAppData%\Microsoft\Office\16.0\OfficeFileCache")

does it better, in case the user set their %UserProfile% to another directory.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!