Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Making .bat File Need Help Please
Closed Thread
Old 05-07-2006, 09:56 PM   #1 (permalink)
 
True Techie

Join Date: Mar 2006

Posts: 193

MackAttack

Default Making .bat File Need Help Please

Hey I've been messing around with trying to make BATCH files...but no luck..

for example if I wanna delete something like say I wanna delete a file which is on my C drive called Songs....how do I do that?...I read some things on the internet and this is what I wrote down:


cls
deltree /y C:\SONGS
cls
EXIT


it won't work??? I don't know why im probably missing something but I don't know what...if anyone could give me some pointers or how to get this to delete would you let me know thanks..or if this isn't wrong what am I doing wrong that wont make this delete that specific folder...

thanks


also after I create this batch file is tehre anyway I can change the icon so it looks like an Image icon??? or like just any other icon??

thanks
MackAttack is offline  
Old 05-08-2006, 10:49 AM   #2 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default Re: Making .bat File Need Help Please

Quote:
Originally posted by MackAttack
for example if I wanna delete something like say I wanna delete a file which is on my C drive called Songs....how do I do that

del songs /Q


del - command, delete one or more files
songs - argument, in this case the file to delete
/Q - switch, turn on quiet mode for no prompts
office politics is offline  
Old 05-08-2006, 11:05 AM   #3 (permalink)
 
True Techie

Join Date: Mar 2006

Posts: 193

MackAttack

Default

cool thanks

but don't I have to put like C:/songs???? so it knows where the folder is located?

thanks
MackAttack is offline  
Old 05-08-2006, 03:27 PM   #4 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default

the code i posted earlier will delete a file named songs

to delete a dir you will need to use rmdir

Code:
C:\>rmdir /?
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

office politics is offline  
Old 05-09-2006, 02:52 AM   #5 (permalink)
 
Junior Techie

Join Date: Oct 2005

Posts: 75

darkninja

Default

Quote:
like say I wanna delete a file which is on
A FILE requires an extention.

EG: My_Resume.doc
where .doc specifies that it is a document used by MS Word

Another EG: (Just in case) MyBatchFile.BAT
where .BAT specifies that it is a Batch file and is to be executed by a command.exe/cmd.exe

Hope that helps!!!
__________________
<a href="http://www.flashyflashy.net" target="_blank">flashyflashy.net</a>
darkninja is offline  
Old 05-09-2006, 09:58 AM   #6 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default

Quote:
Originally posted by darkninja
A FILE requires an extention.
buzzz. you are incorrect. prime example is a windows hosts file.
office politics is offline  
Old 05-10-2006, 02:22 AM   #7 (permalink)
 
Junior Techie

Join Date: Oct 2005

Posts: 75

darkninja

Default

I'm assuming its a bunch of songs or a single song he's trying to delete, not host files
__________________
<a href="http://www.flashyflashy.net" target="_blank">flashyflashy.net</a>
darkninja is offline  
Old 05-10-2006, 10:28 PM   #8 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default

he can also use wildcards.

* for any single or multiple amount of characters. example: *.* for any file with an extension

? for any single character. example: greenday?? for files like greenday01, greenday02, greenday03
office politics is offline  
 
Closed Thread

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On