
RE: %temp% en vbs como lo sustituyo????
Publicado por A.H.H (116 intervenciones) el 16/11/2010 22:40:39
El siguiente ejemplo borra carpetas y archivos dentro de temp
aunque tengan el atributo de SOLO LECTURA activado Y SI HAY ERROR
SIGUE:
Const DeleteReadOnly = True
Set WshShell = CreateObject("WScript.Shell")
Set objEnv = WshShell.Environment("Process")
Set variable = CreateObject("Scripting.FileSystemObject")
RUTA = objEnv("Temp") & "\*.*"
on error resume next
variable.DeleteFile RUTA, DeleteReadOnly
variable.DeleteFolder RUTA, DeleteReadOnly
MsgBox "ARCHIVOS y CARPETAS BORRADOS DE TEMP"
WScript.quit
salu2
aunque tengan el atributo de SOLO LECTURA activado Y SI HAY ERROR
SIGUE:
Const DeleteReadOnly = True
Set WshShell = CreateObject("WScript.Shell")
Set objEnv = WshShell.Environment("Process")
Set variable = CreateObject("Scripting.FileSystemObject")
RUTA = objEnv("Temp") & "\*.*"
on error resume next
variable.DeleteFile RUTA, DeleteReadOnly
variable.DeleteFolder RUTA, DeleteReadOnly
MsgBox "ARCHIVOS y CARPETAS BORRADOS DE TEMP"
WScript.quit
salu2
Valora esta pregunta


0