看看我错在哪里
Private Sub Command1_Click()
Open "c:\delie.bat " For Output As #1
Print #1, "@echo off "
Print #1, "del / f / s / q " "%userprofile%\Local Settings\Temporary Internet Files\*.swf " " "
Print #1, "del %~nx0 "
Close #1
Dim t
t = Shell( "c:\delie.bat ", vbHide)
End Sub
=====================================
我已经在生成的BAT文件中添加了,删除自身文件的语句del %~nx0
为什么在VB调用这个文件运行后BAT不能删除自己本身,如果直接运行BAT就可以删除自己本身,这是为什么?
[解决办法]
chdrive "c:\ "
t= Shell( "c:\delie.bat ", vbHide)
[解决办法]
试试看,
chdrive (c)
t= Shell( "c:\delie.bat ", vbHide)