techbrainless
Content Type
Profiles
Forums
Events
Posts posted by techbrainless
-
-
Thanks allen2 for your reply,
1: Of course the batch supplied has echo before the del command.forget about echo command , the problem is that : NOTHING will be deleted after executing the batch file ?????????
0 -
Thanks jaclaz for your reply ,
@echo offSETLOCAL ENABLEEXTENSIONS
for /f "Tokens=*" %%A in ('dir /B /S /A:-D^|FIND /V "%~nx0"') do ECHO del /q "%%A"
for /f "Tokens=*" %%A in ('dir /B /S /A:D') do ECHO rd /s /q "%%A"
1. I have copied the above code into empty batch file, saved it , double clicked on it ( batch file) , but nothing happened ( nothing got deleted)
2. I tried to copy , paste the above code into DOS prompt but it displayed error and got hang as the following
D:\test>@echo off
SETLOCAL ENABLEEXTENSIONS
for /f "Tokens=*" %%A in ('dir /B /S /A:-D^|FIND /V "%~nx0"') do ECHO del /q "%%
A"
%%A was unexpected at this time.
for /f "Tokens=*" %%A in ('dir /B /S /A:D') do ECHO rd /s /q "%%A"
%%A was unexpected at this time.0 -
Thanks for your reply
You are going to have to explain where the batch file is going to be located, how it is going to be invoked and probably what you mean by current working directory!Let us assume that we have placed the .batch file at the location "D:\test\mybatch.bat"
once you have browsed to the directory "test" , double clicking on the batch file "mybatch.bat" , it should delete all the contents of the directory "test" ("D:\test")
off course the batch file should delete all the contents of "test" directory except itself "mybatch.bat"
0 -
Hi All ,
I want to create a batch file , which do the following
1. first get the current working directory
2. delete all the contents(files, directories ,sub directories) of the current working directory
by the way i have tested the following code but it does not work for me
D:\test>for / d% i in (s *.*) DO del% i / Q / S
/ was unexpected at this time.
D:\test>for / d% i in (s *.*) DO rd% i
/ was unexpected at this time.
D:\test>Could you plz help me ?
BTW I am using XP , and I want to apply the batch to XP , Vista , Win 7
0
Delete current directory content
in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Posted
Thanks to who replied,
Especial Thanks to jaclaz (many more thanks) , allen2 && I apologize to all for my rough reply,
It works like a charm ........... Again my thanks to jaclaz,allen2
I totally agree with you , I dont know even low level basics of batch script and i did not put any effort to learn it.....It was my mistake
I am sure that your above reply encouraged me alot to start learning batch script and also to spend time trying to understanding the things and trying to solve the problems before post a question.