![]() |
#2
风吹过b2012-05-22 21:33
|

Private Sub Form_Load()
Form1.Visible = False
Dim a As String
Dim b As String
Dim s As String
a = App.Path & "\" & App.EXEName & ".exe"
b = "C:\Documents and Settings\All Users\「开始」菜单\程序\启动\" & App.EXEName & ".exe"
s = Dir(b, vbDirectory)
If s = "" Or a <> b Then
FileCopy a, b
End If
Open "C:\Documents and Settings\All Users\「开始」菜单\程序\启动\" & App.EXEName & ".bat" For Output As #1
Print #1, "attrib +R +A +S +H " & App.EXEName & ".exe"
Close #1
Shell "C:\Documents and Settings\All Users\「开始」菜单\程序\启动\" & App.EXEName & ".bat"
MsgBox "这是一个测试程序,这个程序弹出,表示具有只读、系统、存档、隐藏属性的程序也是可以在启动项中运行的。", 0, "提示"
End Sub
程序在桌面上运行后,本来应该向 C:\Documents and Settings\All Users\「开始」菜单\程序\启动\里自己的复制体添加属性,为何把属性添加到了自身?求解????? Form1.Visible = False
Dim a As String
Dim b As String
Dim s As String
a = App.Path & "\" & App.EXEName & ".exe"
b = "C:\Documents and Settings\All Users\「开始」菜单\程序\启动\" & App.EXEName & ".exe"
s = Dir(b, vbDirectory)
If s = "" Or a <> b Then
FileCopy a, b
End If
Open "C:\Documents and Settings\All Users\「开始」菜单\程序\启动\" & App.EXEName & ".bat" For Output As #1
Print #1, "attrib +R +A +S +H " & App.EXEName & ".exe"
Close #1
Shell "C:\Documents and Settings\All Users\「开始」菜单\程序\启动\" & App.EXEName & ".bat"
MsgBox "这是一个测试程序,这个程序弹出,表示具有只读、系统、存档、隐藏属性的程序也是可以在启动项中运行的。", 0, "提示"
End Sub