第一次海报长时间读者。我想说,谢谢你们所有的工作。我一直在研究一个VB项目,目前我们有一些用dos编写的工具,但它的日期和目前只是不适用于&%^ $。我批准的是这个。未处理的异常类型'System.Security.SecurityException'
if exist %userprofile%\Local GOTO W7
RD /s /q "%userprofile%\Local Settings\Application Data\Our Company Folder"
RD /s /q "%userprofile%\AppData\Local\Our Company Folder"
发生损坏时删除我们公司的配置文件夹。
既然我们有在VB中创建的支持工具,我想将此命令更改为VB。
这是我现在已经是
Dim fso
Dim wshshell As Object
Dim USRPROFILE
fso = CreateObject("scripting.filesystemobject")
wshshell = CreateObject("wscript.shell")
USRPROFILE = wshshell.expandenvironmentstrings("%APPDATA%")
If fso.FolderExists(USRPROFILE & "\Our Company Folder") Then
fso.DeleteFolder(USRPROFILE & "\Our Company Folder")
End If
USRPROFILE = wshshell.expandenvironmentstrings("%HOMEPATH%")
If fso.FolderExists(USRPROFILE & "\Local Settings\Application Data\Our Company Folder") Then
fso.DeleteFolder(USRPROFILE & "\Local Settings\Application Data\Our Company Folder")
End If
End Sub
但是我收到此错误信息。 类型“System.Security.SecurityException”的未处理的异常发生在Microsoft.VisualBasic.dll中
其他信息:从HRESULT异常:0x800A0046(CTL_E_PERMISSIONDENIED)
怎么会变成这样解决? – user2543297