I need a batch script to delete the same directory in multiple computers. I'm not very good with batch, so could someone please tell me how to go about doing this? Thanks.
Which directory do you mean?
del "FULL FILE PATH HERE"
C:\Program Files\Windows Sidebar and a few others.
I have quite a few computers to do this to, so I want to just run the script and move on to the next computer.
[editline]11:37PM[/editline]
[QUOTE=pl0xinat0r;19479242]del "FULL FILE PATH HERE"[/QUOTE]
Nothing more, nothing less? Just make a new line for each directory i want to delete?
yes.
[editline]04:38AM[/editline]
there are a few options for "Del" you might need, type "help del" to view them. also, you may have to run in safemode, if you want to delete something like... system32.
Sounds like somebody wants to make a 'BATCH VIRUS' to delete system32.
so
[code]
del C:\Program Files\Windows Sidebar
del C:\Program Files\adobe
[/code]
[editline]11:39PM[/editline]
[QUOTE=Eleventeen;19479326]Sounds like somebody wants to make a 'BATCH VIRUS' to delete system32.[/QUOTE]
No.
you could do
[code]
cd "C:\Program Files"
del "windows sidebar"
del "adobe"
[/code]
Not working. Cmd comes up and asks me yes or no, i type y and it doesn't delete it.
as i said, you may have to be in safe mode, and there are a few options to overwrite certain protections and stuff.
Use rd instead. [code]rd <FOLDERPATH(example: C:\Windows\> -q[/code]
-q is a parameter that deletes everything, without asking you if you want to.
Do i include the < and > around the path?
[editline]12:00AM[/editline]
I've tried
[code]
rd <C:\Program Files\Windows Sidebar> -q
and
rd C:\Program Files\Windows Sidebar -q
[/code]
Neither worked.
[editline]12:01AM[/editline]
With just that line.
You need quotes around the path.
[QUOTE=turby;19480075]You need quotes around the path.[/QUOTE]
Yeah, whenever a space/special char is included in the path, you need quotes.
more batch hackers
Did it with quotes too. No luck.
[QUOTE=its shortie;19493162]Did it with quotes too. No luck.[/QUOTE]
Well, Sean, I don't know what to tell you because:
[code]
rd "C:\Program Files\Windows Sidebar" -q
[/code]
[B]Should[/B] have worked.
[code]
> rd /?
Removes (deletes) a directory
RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.
/Q Quiet mode, do not ask if ok to remove a directory tree with /S
[/code]
So to recap, boys and girls, the command line switch goes before the path, and in Windows (this ain't UNIX now), we put a [i]slash[/i] before the switch.
[QUOTE=turby;19497080]
So to recap, boys and girls, the command line switch goes before the path, and in Windows (this ain't UNIX now), we put a [i]slash[/i] before the switch.[/QUOTE]
It doesn't matters. Atleast not for rd, it will still delete the folder, it just gives out an error, still the folder is deleted afterwards.
This might work then: [code]cd "C:\Program Files"
rd /q "Windows Sidebar"[/code]
[QUOTE=turby;19497080]
So to recap, boys and girls, the command line switch goes before the path, and in Windows (this ain't UNIX now), we put a [i]slash[/i] before the switch.[/QUOTE]
Well, I use Linux enough, I get them confused. ;3
Just use this:
[code]
del /f "C:\\Program Files\Balhah\jnhjabja"
[/code]
A tiny but useful addition to this might be environment variables.
like if you have a folder on your home drive (like System32), but the home drive isn't C and you don't know the character of it, you can use the variable %SYSTEMDRIVE%. In my case it outputs "D:" because D: is where i installed my version of Windows. Yet you may (like me) have your programs on ANOTHER drive then C and not the same drive as %SYSTEMDRIVE%. You can use %PROGRAMFILES% to find that (This assumes that the programs are installed on another drive, and that the drive is ALSO edit'd in the registry. All these variables and many more exist! To view and/or output a list of most (if not all) of these, type "SET >> [file-to-save].txt" to output a list of variables into that file.
[QUOTE=mastersrp;19509323]A tiny but useful addition to this might be environment variables.
like if you have a folder on your home drive (like System32), but the home drive isn't C and you don't know the character of it, you can use the variable %SYSTEMDRIVE%. In my case it outputs "D:" because D: is where i installed my version of Windows. Yet you may (like me) have your programs on ANOTHER drive then C and not the same drive as %SYSTEMDRIVE%. You can use %PROGRAMFILES% to find that (This assumes that the programs are installed on another drive, and that the drive is ALSO edit'd in the registry. All these variables and many more exist! To view and/or output a list of most (if not all) of these, type "SET >> [file-to-save].txt" to output a list of variables into that file.[/QUOTE]
Whilst reading this I thought you made a smiley because it was saying "NO!"
I thought this "D:" was the smiley...
I lol'd.
D:
[QUOTE=efeX;19525275]D:[/QUOTE]
You're not helping, so stop crying.
Sorry, you need to Log In to post a reply to this thread.