求一个BAT小程序 用于删除指定目录的

求一个BAT小程序 用于删除指定目录的,第1张

del /s C:\WINDOWS\1\*.*

或者

del /s E:\工具\Lenovo\*.*

以下是关于del命令的说明:

删除一个或数个文件

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

names 指定一个或多个文件或者目录列表。

通配符可用来删除多个文件。

如果指定了一个目录,该目录中的所

有文件都会被删除。

/P删除每一个文件之前提示确认。

/F强制删除只读文件。

/S删除所有子目录中的指定的文件。

/Q安静模式。删除全局通配符时,不要求确认

/A根据属性选择要删除的文件

属性 R 只读文件 S 系统文件

H 隐藏文件 A 存档文件

I 无内容索引文件 L 重分析点

- 表示“否”的前缀

如果命令扩展被启用,DEL 和 ERASE 更改如下:

/S 开关的显示句法会颠倒,即只显示已经

删除的文件,而不显示找不到的文件。

VB6:

你可以在工程里多建一个窗体, *** 作的菜单写在这里,不显示9 OK了

当你要的窗体关闭后 再+载托盘

VB.NET里直接9有Closing和Closed事件

以下9是托盘:

Dim OldWindowProc As Long

Dim TheForm As Form

Dim TheMenu As Menu

Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _

(ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, _

ByVal wParam As Long, ByVal lParam As Long) As Long

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _

(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Declare Function GetWindowLong Lib "user32" Alias _

"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

Declare Function SetLayeredWindowAttributes Lib "user32" _

(ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, _

ByVal dwFlags As Long) As Long

Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" _

(ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long

Type NOTIFYICONDATA

cbSize As Long

hwnd As Long

Uid As Long

UFlags As Long

UCallbackMessage As Long

HIcon As Long

SzTip As String * 64

End Type

Private TheData As NOTIFYICONDATA

Public Function NewWindowProc(ByVal hwnd As Long, ByVal Msg As Long, _

ByVal wParam As Long, ByVal lParam As Long) As Long

If Msg = (&H400 + 1001&) Then

If lParam = &H205 Then

FormM.SetFocus

TheForm.PopupMenu TheMenu

Exit Function

End If

End If

NewWindowProc = CallWindowProc(OldWindowProc, hwnd, Msg, wParam, lParam)

End Function

Public Sub AddToTray(frm As Form, mnu As Menu)

Set TheForm = frm

Set TheMenu = mnu

OldWindowProc = SetWindowLong(frm.hwnd, (-4), AddressOf NewWindowProc)

With TheData

.Uid = 0

.hwnd = frm.hwnd

.cbSize = Len(TheData)

.HIcon = frm.Icon.Handle

.UFlags = 2

.UCallbackMessage = (&H400 + 1001&)

.UFlags = .UFlags Or 1

.cbSize = Len(TheData)

End With

Shell_NotifyIcon 0, TheData

End Sub

Public Sub RemoveFromTray()

With TheData

.UFlags = 0

End With

Shell_NotifyIcon 2, TheData

SetWindowLong TheForm.hwnd, (-4), OldWindowProc

End Sub

Public Sub SetTrayTip(tip As String)

With TheData

.SzTip = tip &vbNullChar

.UFlags = 4

End With

Shell_NotifyIcon 1, TheData

End Sub


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/11563649.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-17
下一篇 2023-05-17

发表评论

登录后才能评论

评论列表(0条)

保存