JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 31st, 2006, 12:15 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 471 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 10 m 16 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
Exclamation Problem in Batch/MS-DOS scripting

I Know this is a javascript post but i cant find a .bat /ms-dos fourm so i will post here, lol

i have a problem trying to delete all directories in a directory
here is my code (its for a disk check-up/clean-up)
Code:
@ECHO OFF
STARTLOCAL
COLOR 0A
GOTO WELCOME

:START
CLS
GOTO STARTCHECK

:STARTCHECK
ECHO Performing An Error Check On Your Directories...
ECHO NOTE: Analyzing Only
ECHO -
SET origdir=%cd%
SET origdrive=
SET user=%userprofile%
SET cook=%user%\Cookies
SET temp=%user%\Local Settings\Temp
SET TIFS=%user%\Local Settings\Temporary Internet Files
SET SYST=%systemroot%\Temp
GOTO CHECK

:RESTCHECK
ECHO All Checks Have Been Completed Successfully.
PAUSE
GOTO LICENCE

:CHECK
ECHO Atempting To Access: %systemdrive%
%systemdrive%
ECHO Atempting To Access: %cook%
SET noteErrordir=%cook% & cd "%cook%" & IF NOT "%cd%"=="%user%\Cookies" SET ER=true
ECHO Atempting To Access: %temp%
SET noteErrordir=%temp% & cd "%temp%" & IF NOT "%cd%"=="%user%\Local Settings\Temp" SET ER=true
ECHO Atempting To Access: %TIFS%
SET noteErrordir=%TIFS% & cd "%TIFS%" & IF NOT "%cd%"=="%user%\Local Settings\Temporary Internet Files" SET ER=true
ECHO Atempting To Access: %SYST%
SET noteErrordir=%SYST% & cd "%SYST%" & IF NOT "%cd%"=="%systemroot%\Temp" SET ER=true
GOTO RESTCHECK
IF %ER%==true GOTO _ERROR
IF NOT %ER%==true GOTO RESTCHECK

:WELCOME
CLS
ECHO Hello %username%,
ECHO -
ECHO Thank You For Running The Disk Clean-up Created By Colton22, What This Files Does Is It Purges (Deletes) All Files That Were Created By Browsing The Internet and/or All Temporary Files Created and Left Over By Programs,ECHO These Folders Locations Are...
ECHO 	 - %userprofile%\Cookies
ECHO 	 - %userprofile%\Local Settings\Temp
ECHO 	 - %userprofile%\Local Settings\Temporary Internet Files
ECHO 	 - %systemroot%\Temp
ECHO 	 - %userprofile%\Desktop\Recycle Bin
ECHO As Shown Above, All Information Is Extracted From The Following Information...
ECHO 	Your Current Operating System: %OS%
ECHO 	Your Current Domain Name: %userdomain%
ECHO 	Your Current User Name: %username%
ECHO 	Your System Root Directory: %systemroot%
ECHO 	Your User Directory: %userprofile%
ECHO To Move On
PAUSE
GOTO START

:LICENCE
PUSHD "%origdir%"
md "Agreed_Users"
cd "Agreed_Users"
ATTRIB +H +R "..\Agreed_Users"
cd "%userdomain%_%username%_%OS%"
IF "%cd%"=="%origdir%\Agreed_Users\%userdomain%_%username%_%OS  %" GOTO CONT
CD "%origdir%"
CLS
ECHO Licence Agreement For Disk Clean-up Created By Colton22
ECHO NOTE: To Go To The Next Page Press The Space Bar ^[  SPACE  ^]
PAUSE
MORE License.txt /E /P /T5 +3
ECHO -
ECHO -
ECHO End Of End-User Licence Agreement
PAUSE
GOTO checkagree

:checkagree
CLS
ECHO NOTE: Next Step IS Case Sensitive
SET /P doesuseragree?=If You Do Not Agree To The Licence Agreement, Type The Following "I Disagree", If You Agree To The Licence Agreement Just Shown Type The Following "I Agree" and Press Enter:
IF NOT "%doesuseragree?%"=="I Agree" IF NOT "%doesuseragree?%"=="I Disagree" GOTO AGREE2
IF "%doesuseragree?%"=="I Agree" GOTO SETFILEFORAGREE
IF "%doesuseragree?%"=="I Disagree" GOTO DIFFEXIT

:AGREE2
SET /P doesagree2?=I^'m Sorry, I Couldn^'t Understand Your Last Statment, Would You Like To Try Again? ^(y=yes^|n=no^)
IF NOT %doesagree2?%==Y IF NOT %doesagree2?%==N IF NOT %doesagree2?%==y IF NOT %doesagree2?%==n GOTO AGREE2 
IF %doesagree2?%==y GOTO checkagree
IF %doesagree2?%==Y GOTO checkagree
IF %doesagree2?%==n GOTO DIFFEXIT
IF %doesagree2?%==N GOTO DIFFEXIT


:DIFFEXIT
CLS
ECHO Thanks For Running The Disk Clean-up By Colton22
pause
exit

:SETFILEFORAGREE
PUSHD "%origdir%\Agreed_Users"
MD "%userdomain%_%username%_%OS%"
ATTRIB +H +R "%userdomain%_%username%_%OS%"
POPD
GOTO CONT

:CONT
POPD
CLS
GOTO _DELETE

:_ERROR
COLOR C0
ECHO An Error Has Occured While Accessing One Of The Above Directorys...
ECHO -
ECHO Please Make Sure You Have Access To This Directory and Run This File Again.
PAUSE
ECHO ON
EXIT

:_DELETE
ECHO The Following Will Delete All Of Your Temporary Internet Files
SET /P isoktodelete=Continue? ^(y=yes^|n=no^)
IF NOT %isoktodelete%==N IF NOT %isoktodelete%==Y IF NOT %isoktodelete%==n IF NOT %isoktodelete%==y GOTO _DELETE
IF %isoktodelete%==y GOTO _CONTDELETE
IF %isoktodelete%==Y GOTO _CONTDELETE
IF %isoktodelete%==n GOTO _DEFRAGA
IF %isoktodelete%==N GOTO _DEFRAGA

:_CONTDELETE
CD %cook%
IF %cd%==%cook% DEL *.* /S /Q
CD %temp%
CD ..\
IF %cd%=="%userprofile%\Local Settings" (RD /S /Q "Temporary Internet Files" "Temp" & MD "Temporary Internet Files" "Temp")
CD %SYST%
IF %cd%==%SYST% (CD ..\ & RD /S /Q "Temp" & MD "Temp")
pause
goto _DEFRAGA

:_DEFRAGA
CLS
cd\
ECHO Defragmentor...
ECHO -
DEFRAG %cd% -A
ECHO - 
GOTO ASK

:_DEFRAG
DEFRAG %cd%
GOTO ENDSCREEN

:ASK
SET /P isoktodefrag=Do You Wish To Defrag? ^(y=yes^|n=no^)
IF NOT %isoktodefrag%==n IF NOT %isoktodefrag%==y IF NOT %isoktodefrag%==Y IF NOT %isoktodefrag%==N GOTO ASK
IF %isoktodefrag%==y GOTO _DEFRAG
IF %isoktodefrag%==Y GOTO _DEFRAG
IF %isoktodefrag%==n GOTO ENDSCREEN
IF %isoktodefrag%==N GOTO ENDSCREEN

:ENDSCREEN
COLOR C0
CLS
ECHO All Tasks Have Been Completed Except One (CHKDSK)
SET /P isoktochkdsk=Complete The Last Task? ^(y=yes^|n=no^)
IF NOT %isoktochkdsk%==y IF NOT %isoktochkdsk%==n IF NOT %isoktochkdsk%==Y IF NOT %isoktochkdsk%==N GOTO ENDSCREEN
IF %isoktochkdsk%==y GOTO CKDK
IF %isoktochkdsk%==Y GOTO CKDK
IF %isoktochkdsk%==n GOTO END
IF %isoktochkdsk%==N GOTO END

:CKDK
COLOR 0A
CLS
CHKDSK
GOTO CHKASK

:CHKASK
ECHO If There Were Problems Found Would You Like To Fix Them?? ^(y=yes^|n=no^)
SET /P isoktofixprobs=
IF NOT %isoktofixprobs%==y IF NOT %isoktofixprobs%==n IF NOT %isoktofixprobs%==N IF NOT %isoktofixprobs%==Y GOTO CHKASK
IF %isoktofixprobs%==y (CHKDSK /F /V & GOTO END)
IF %isoktofixprobs%==Y (CHKDSK /F /V & GOTO END)
IF %isoktofixprobs%==n GOTO END
IF %isoktofixprobs%==N GOTO END

:END
ENDLOCAL
COLOR 0A
CLS
ECHO All Problems Have Been Fixed, Thank You For Using Disk Clean-up By Colton22!
PAUSE 
ECHO On
EXIT

I Want To Be Able To, Instead of doing...

RD /S /Q "Temp" & MD "Temp"

I Would Like To Do Something Similar To...

DEL *.* /S /Q

It Would Look Like This...

RD /S /Q *

*=Wildcard

but it wont work that way it will say directory name "*" invalid

can anyone help me??

Last edited by colton22 : August 1st, 2006 at 12:02 PM. Reason: Changed from quote to code

Reply With Quote
  #2  
Old July 31st, 2006, 02:31 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 34 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
Not possible with normal DOS commando's, sorry.
You could write a special program or script for it, but in the end, it'd be more work than deleting the directory and recreating it, as you did.



Quote:
Originally Posted by colton22
I Know this is a javascript post but i cant find a .bat /ms-dos fourm so i will post here, lol


We have the General Programming Help Forum for that

I'll ask one of the mods to move this thread.
__________________
This is my code. Is it not nifty?

"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams


Join the Itsacon fanclub!    
Zero Tolerance: Spammers banned so far: 264

Reply With Quote
  #3  
Old July 31st, 2006, 06:39 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 471 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 10 m 16 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
alright thanks

colton22

Reply With Quote
  #4  
Old July 31st, 2006, 11:11 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 34 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
Well, I wasn't that helpful, but you're welcome ;-)

Reply With Quote
  #5  
Old August 1st, 2006, 08:50 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
We also recommend you wrap your code fragments in [code][/code] tags when posting to the forums... the quote tags are a start, but code is better
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
  #6  
Old August 1st, 2006, 08:55 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 34 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
I was about to ask why you hadn't moved this thread yet, but then I saw you have no power here. Only ChiefWigs has...
Comments on this post
MadCowDzz agrees: I am powerless in these forums.

Last edited by Itsacon : August 1st, 2006 at 08:59 AM.

Reply With Quote
  #7  
Old August 1st, 2006, 12:02 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 471 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 10 m 16 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
well i learned something new, with the code tags, thanks

Reply With Quote
  #8  
Old August 1st, 2006, 12:08 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 471 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 10 m 16 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
also i couldnt help but notice..

Itsacon

Command Line Warrior
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 666
Time spent in forums: 4 Days 9 h 25 m 2 sec
Reputation Power: 2

nice amount of posts lol


colton22

Reply With Quote
  #9  
Old August 2nd, 2006, 05:34 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 34 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
Yeah. I'm evil, I know...

Reply With Quote
  #10  
Old August 2nd, 2006, 04:30 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 471 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 10 m 16 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
ha, yea, i have 2 more probs though, there posted in general, it all deals with adding to var's together to equal the name of another var and then call the new var's name, it's explained

colton22

ps thx again

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Problem in Batch/MS-DOS scripting


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |