- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Microsoft
- >
- Re: how to write a batch file in windows??
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2006 08:14 AM
тАО08-25-2006 08:14 AM
Re: how to write a batch file in windows??
So you r looping it to find all dir and delete one by one. I haven't checked it out but if it works thats awesome. *bows down* But my way is still better simple yet efficient. Even though the thought occured to me to use a loop I didn't know how to do it. Heck this is the first time I see a 'for' command used as dos command(gotta learn more). But since Kabucek does not want anything to be in the folder I think my option works..just a sweet wam bam thank you mam.
Regards,
Shijo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2006 08:19 AM
тАО08-25-2006 08:19 AM
Re: how to write a batch file in windows??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2006 09:29 AM
тАО08-25-2006 09:29 AM
Re: how to write a batch file in windows??
Jon the for loop does not work, I think the problem is even though the loop might work the my_folder var still has the name of the intial dir, U need to extract the name of each dir in the loop and put it in var my_folder and I don't know how so some guidance please.
Kabucek what u r trying to do does not make any sense, why do you want to put it in the directory when u still have to specify the name of the directory anyway. Put the dat file in the root directory and just execute with the name of the folder u wanna nuke.
Regards,
Shijo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2006 11:57 AM
тАО08-25-2006 11:57 AM
Re: how to write a batch file in windows??
del /F *.*
del /F /AH *.*
for /f %%i in ('dir /b /ad') do rmdir %my_folder%\%%i
goto done
**note that it "may" wrap, but the command should be on the same line.
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2006 12:28 PM
тАО08-25-2006 12:28 PM
Re: how to write a batch file in windows??
@echo off
rem .:-------------------------------------
rem .: Delete all files within a folder
rem .:-------------------------------------
for /f %%i in ('cd') do set cur_dir=%%i
set /P my_folder="Please enter folder to delete files within: "
if exist %my_folder% goto do_dfile
goto error
:do_dfile
cd %my_folder%
del /F /Q *.* > nul
del /F /Q /AH *.* > nul
for /f %%i in ('dir /b /ad') do rmdir /S /Q "%my_folder%\%%i" > nul
cd %cur_dir%
goto done
:error
echo Folder was not found.
:done
rem .:-------------------------------------
rem .: End of delete script
rem .:-------------------------------------
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2006 03:31 AM
тАО08-28-2006 03:31 AM
Re: how to write a batch file in windows??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2006 04:33 AM
тАО08-28-2006 04:33 AM
Re: how to write a batch file in windows??
If you'd like to help other members with questions, and you're interesed in earning points, here's how:
http://forums1.itrc.hp.com/service/forums/helptips.do?#28
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2006 06:53 AM
тАО08-28-2006 06:53 AM
Re: how to write a batch file in windows??
rem .:-------------------------------------
rem .: Delete all files within a folder
rem .:-------------------------------------
for /f %%i in ('cd') do set cur_dir=%%i
set /P my_folder="Please enter folder to delete files within: "
if exist %my_folder% goto do_dfile
goto error
:do_dfile
cd %my_folder%
del /F /Q *.* > nul
del /F /Q /AH *.* > nul
for /f %%i in ('dir /b /ad') do rmdir /S /Q "%my_folder%\%%i" > nul
cd %cur_dir%
goto done
:error
echo Folder was not found.
:done
rem .:-------------------------------------
rem .: End of delete script
rem .:-------------------------------------
- i've got message:
The system cannot find specified file.. why?????
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2006 06:57 AM
тАО08-28-2006 06:57 AM
Re: how to write a batch file in windows??
why it's not deleting new Briefcase file??? any other files are deleted but not that one, why??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2006 10:14 AM
тАО08-28-2006 10:14 AM
Re: how to write a batch file in windows??
Windows probably believed that it was in use, or was flagged as a system folder so as not to be deleted.
Try running "attrib" on the folder, or view the folder attributes through Windows Explorer.
Jon