Source language: Translate to:

How do I delete everything in the folder C: \ Windows \ Temp

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Postby Neosoft Support » Mon May 23, 2011 10:44 am

You can try something like this (but use caution):

Code: Select all
Run "del" "[TempDir]*.* /Q" "Normal" "" ""
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby dpayer » Mon May 23, 2011 7:16 pm

Neosoft Support wrote:You can try something like this (but use caution):

Code: Select all
Run "del" "[TempDir]*.* /Q" "Normal" "" ""


I never had success running attributes of the cmd.exe or command.exe without first executing it and using those functions in a batch file. Del is not an executable by itself. It is a function of cmd.exe

David P
User avatar
dpayer
 
Posts: 1383
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Postby Neosoft Support » Tue May 24, 2011 10:12 am

NeoBook (at least more recent versions) understands the Del command and can execute it directly from the Run action.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby CN_Iceman » Wed May 25, 2011 2:44 am

Like dpayer says... It's easy to make and execute a Batch file.

Something like this:
Code: Select all
@Echo off
Cls
Del /F /S /Q /A:RHSA *.*


Then use the Run Command calling that batch file instead of Del command.

The DOS Command DELTREE it is better and faster to delete files and folders, but it doesn't work on Vista/7.

Greetings.

NOTE: Take care with /Q parameter (silence mode, without confirmation)... Chech "Del /?" on your DOS Window to know the use of those parameters before make the Batch file.
Greetings/Saludos, Jose.
www.icemansoft.es
User avatar
CN_Iceman
 
Posts: 297
Joined: Tue Mar 01, 2011 11:04 am
Location: España

Postby Neosoft Support » Wed May 25, 2011 10:40 am

In fact, it does not work, leaving behind a black screen and goes very fast, but does not erase the contents of the folder something happens that takes nothing away, something is missing a command to do delete the entire contents of that folder.


Actually, I tested it here and it works on my PC. The black screen indicates that the Del command is being executed by Windows. Try the command without the "/Q" option and the black screen will stay open allowing you to read any prompts or error messages. For example:

Run "del" "[TempDir]*.*" "Normal" "" ""

You should see something like this:

Image
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Neosoft Support » Fri May 27, 2011 10:13 am

Run "del" "C:\Windows\Temp\*.*" "Normal" "" ""

Although, if User Access Control (UAC) is turned on, Windows may not allow you to delete files. That's not a NeoBook problem - it's a Windows problem.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby aguilar955 » Sun May 29, 2011 2:26 pm

Need the plugin ... Neodouble - David Esperalta

GoSub "Limpia_Temporal_Windows"
GoSub "Limpia_Temporal_Sistema"

Code: Select all
:Limpia_Temporal_Windows
DefineVar "[Archivos]" "Undefined" "" "Local" ""
DefineVar "[DirTemp]" "Undefined" "" "Local" ""
DefineVar "[i]" "Integer" "" "Local" ""
DefineVar "[Total]" "Integer" "" "Local" ""
DefineVar "[esCarpeta]" "Boolean" "" "Local" "False"

SetVar "[DirTemp]" "[WindowsDir]Temp\"

FileList "[DirTemp]*.*" "Files+Folders" "[Archivos]"
StrParse "[Archivos]" "[#13]" "[Elemento]" "[Total]"
Loop "1" "[Total]" "[i]"
    FolderExists "[DirTemp][Elemento[i]]" "[esCarpeta]"
    If "[esCarpeta]" "=" "True"
        If "[DirTemp]" "<>" "[DirTemp][Elemento[i]]"
            npBorrarCarpeta "[DirTemp][Elemento[i]]" "False" "False"
        Else
        EndIf
    Else
        If "[DirTemp]" "<>" "[DirTemp][Elemento[i]]"
            npBorrarArchivos "[DirTemp][Elemento[i]]" "False" "False"
        Else
        EndIf
    EndIf
    SetVar "[Elemento[i]]" ""
EndLoop
Return

:Limpia_Temporal_Sistema
DefineVar "[Archivos]" "Undefined" "" "Local" ""
DefineVar "[DirTemp]" "Undefined" "" "Local" ""
DefineVar "[i]" "Integer" "" "Local" ""
DefineVar "[Total]" "Integer" "" "Local" ""
DefineVar "[esCarpeta]" "Boolean" "" "Local" "False"

SetVar "[DirTemp]" "[TempDir]"

FileList "[DirTemp]*.*" "Files+Folders" "[Archivos]"
StrParse "[Archivos]" "[#13]" "[Elemento]" "[Total]"
Loop "1" "[Total]" "[i]"
    FolderExists "[DirTemp][Elemento[i]]" "[esCarpeta]"
    If "[esCarpeta]" "=" "True"
        npBorrarCarpeta "[DirTemp][Elemento[i]]" "False" "False"
    Else
        npBorrarArchivos "[DirTemp][Elemento[i]]" "False" "False"
    EndIf
    SetVar "[Elemento[i]]" ""
EndLoop
Return


Can be done in batch, also without using any plugin.

GoSub "Limpia_Temporal_Windows"
GoSub "Limpia_Temporal_Sistema"

Code: Select all
:Limpia_Temporal_Windows
FileWrite "[CurrentDir]delete.bat" "All" "cd [#34]%tmp%[#34]"
FileWrite "[CurrentDir]delete.bat" "Append" "del [#34]%tmp%\*.*[#34] /S /Q /F"
FileWrite "[CurrentDir]delete.bat" "Append" "for /D %%a in ([#34]%tmp%\*.*[#34]) do rmdir [#34]%%a[#34] /S /Q"
FileWrite "[CurrentDir]delete.bat" "Append" "del delete.bat"

Run "delete.bat" "" "Wait+Hidden" "" ""
Return

:Limpia_Temporal_Sistema
FileWrite "[CurrentDir]delete.bat" "All" "cd [#34][WindowsDir]Temp\[#34]"
FileWrite "[CurrentDir]delete.bat" "Append" "del [#34][WindowsDir]Temp\*.*[#34] /S /Q /F"
FileWrite "[CurrentDir]delete.bat" "Append" "for /D %%a in ([#34][WindowsDir]Temp\*.*[#34]) do rmdir [#34]%%a[#34] /S /Q"
FileWrite "[CurrentDir]delete.bat" "Append" "del delete.bat"

Run "delete.bat" "" "Wait+Hidden" "" ""
Return


http://www.neosoftware.com/forum/viewto ... 5#11202565

Salu2
aguilar955
 
Posts: 85
Joined: Sat Jan 17, 2009 10:50 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest