How to delete random file using batch


BurningSuperDef

New member
Local time
4:50 PM
Posts
10
Location
Salt lake city, Utah
OS
Windows 11
Hello. I'm wondering how I could create a batch virus script that deletes a random file from the entire Virtual Machine I am using (Windows 98 SE VM) because I am just trying to do this for my virus script but I don't know how.

Heres the script right now:

-------------------------------------------------------
%echo off%
echo lol>> "C:\Windows\Desktop\GoogleToolbar.exe"
echo lol>> "C:\Windows\Desktop\Spysheriff.exe"
echo lol>> "C:\Windows\Desktop\FreeAvailibleLadies.exe"
echo lol>> "C:\Windows\Desktop\FreeNeoPetMoney.exe"
echo lol>> "C:\Windows\Desktop\WindowsXPUpgrade.exe"
echo lol>> "C:\Windows\Desktop\WinRAR.exe"
echo lol>> "C:\Windows\Desktop\Mcafee.exe"
echo lol>> "C:\Windows\Desktop\Goggle.exe"
echo lol>> "C:\Windows\Desktop\WINDOWS-LEAKS.exe"
echo lol>> "C:\Windows\Desktop\ObviousMalware.exe"
echo lol>> "C:\Windows\Desktop\ILOVEYOU.exe.vbs"
echo lol>> "C:\Windows\Desktop\Mydoom.exe"
echo lol>> "C:\Windows\Desktop\MeetHotGirls.exe"
echo lol>> "C:\Windows\Desktop\Your-File-Has-Been-Downloaded.exe"
echo lol>> "C:\Windows\Desktop\file"
start "" 10 Optimizer - Faster & Cleaner Windows 10/8/7 PC with 1-Click
start "" Home
start "" Google
-------------------------------------------------------

Any suggestions appreciated!


Lee
 
Windows Build/Version
Win 11 22H2

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    DELL
    CPU
    iNTEL cORE I7
    Keyboard
    logitech
    Mouse
    logitech
    Internet Speed
    ?
    Browser
    Google Chrome
    Antivirus
    Windows Antivirus
I have been looking all over the internet for an answer but I could not find one so I went here :)
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    DELL
    CPU
    iNTEL cORE I7
    Keyboard
    logitech
    Mouse
    logitech
    Internet Speed
    ?
    Browser
    Google Chrome
    Antivirus
    Windows Antivirus
When you play with a decrepit Windows like Win 98 -- your scripting options suck. That's why few people want to answer.
 

My Computer

System One

  • OS
    Windows 7
oh, well I also have a windows 7 vm i can use this on if i can edit the script a little bit. is there a way to do it from windows 7 vm?
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    DELL
    CPU
    iNTEL cORE I7
    Keyboard
    logitech
    Mouse
    logitech
    Internet Speed
    ?
    Browser
    Google Chrome
    Antivirus
    Windows Antivirus
Run this script as Administrator: powershell -nop -ep bypass -f RandomFiles.ps1

Currently, the script is in safe mode and only reporting what it would have done. If you remove the "-WhatIf" from the end of the line #8, it will be fully operational. You change the top of folder path, like restrict it to C:\Users or something.

Some files cannot be removed, since you don't have TrustedInstaller rights. You need PowerRun or NSudo to override the system's protections, but this script can cause trouble by itself.

Searching C:\
189811 files.
What if: Performing the operation "Remove File" on target "C:\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35~amd64~~22000.1574.1.10\amd64_microsoft-windows-search-adm.resources_31bf3856ad364e35_7.0.22000.778_fi-fi_988dd0698be55cb0.manifest".
What if: Performing the operation "Remove File" on target "C:\Windows\WinSxS\amd64_microsoft-windows-m..oolsclient.appxmain_31bf3856ad364e35_10.0.22000.120_none_bb415867ae85d51c\BreadcrumbScrollRightHover.png".
What if: Performing the operation "Remove File" on target "C:\Windows\WinSxS\amd64_microsoft-windows-thumbexthost_31bf3856ad364e35_10.0.22000.653_none_ebb4c450c2adc4a8\f\ThumbnailExtractionHost.exe".
What if: Performing the operation "Remove File" on target "C:\Windows\SystemApps\MicrosoftWindows.Client.CBS_cw5n1h2txyewy\Cortana.UI\Assets\Icons\contrast-black\WideTile.scale-150.png".
What if: Performing the operation "Remove File" on target "C:\Windows\WinSxS\Manifests\amd64_containers-disposab..oyment-languagepack_31bf3856ad364e35_10.0.22000.1_en-us_c6bba8e2a4e9987d.manifest".
 

Attachments

  • RandomFiles.ps1
    258 bytes · Views: 1

My Computer

System One

  • OS
    Windows 7
So randomfiles.ps1 I just downloaded. Thats the script, right?
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    DELL
    CPU
    iNTEL cORE I7
    Keyboard
    logitech
    Mouse
    logitech
    Internet Speed
    ?
    Browser
    Google Chrome
    Antivirus
    Windows Antivirus
By the way I tried to remove -WhatIf and I got the same result. But I have to go to bed though. See you tommorow!
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    DELL
    CPU
    iNTEL cORE I7
    Keyboard
    logitech
    Mouse
    logitech
    Internet Speed
    ?
    Browser
    Google Chrome
    Antivirus
    Windows Antivirus
You don't need to copy/paste anything. Just run the script like the command line says.
 

My Computer

System One

  • OS
    Windows 7
What ever happened to the good ol' trusty "Del" (Delete) command?
Has that fallen out of favor? Works all the way from DOS to Windows 11.
If you wanted to delete "C:\Windows\Desktop\GoogleToolbar.exe",,, in a batch file,

Del "C:\Windows\Desktop\GoogleToolbar.exe"

would do the trick! The same would apply to every other line in that example.

:cool:
 

My Computer

System One

  • OS
    Win-11/Pro/64, Optimum 11 V3, 23H2 22631.3085
    Computer type
    PC/Desktop
    Manufacturer/Model
    Home Made w/Gigabyte mobo/DX-10
    CPU
    AMD FX 6350 Six Core
    Motherboard
    Gigabyte, DX-10, GA-78LMT-USB3
    Memory
    Crucial, 16 GB
    Graphics Card(s)
    Onboard, ATI Radeon HD 3000; NVIDEA GeForce 210, 1GB DDR3 Ram.
    Sound Card
    Onboard
    Monitor(s) Displays
    24" Acer
    Screen Resolution
    1280x800
    Hard Drives
    Crucial SSD 500GB, SanDisk 126GB SSD, Toshiba 1TB HD
    PSU
    EVGA 500 W.
    Case
    Pac Man, Mid Tower
    Cooling
    AMD/OEM
    Keyboard
    101 key, Backlit/ Mechanical Switches/
    Mouse
    Logitech USB Wireless M310
    Internet Speed
    Hughes Net speed varies with the weather
    Browser
    Firefox 64x
    Antivirus
    Windows Defender, Super Anti Spyware
    Other Info
    Given to me as DEAD, and irreparable.
    Rebuilt with Gigabyte mobo, AMD cpu, 16GB ram and 500GB Crucial SSD.

Latest Support Threads

Back
Top Bottom