Equivalent %username% for VB script

后端 未结 2 1036
太阳男子
太阳男子 2021-01-17 03:33

I am looking to delete OfficeFileCache folder from the current user\'s computer. Currently I have..

Option Explicit
Dim obj : Set obj =CreateObject (\"wscrip         


        
2条回答
  •  不要未来只要你来
    2021-01-17 04:02

    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")
    

提交回复
热议问题