Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Maya Basics & Newbie Lounge (https://simplymaya.com/forum/forumdisplay.php?f=31)
-   -   help with batch files. (.bat) (https://simplymaya.com/forum/showthread.php?t=8823)

Darkware 07-11-2003 02:10 AM

help with batch files. (.bat)
 
I'm trying to learn how to make batch files on my own so I can easily do certain things on my computer like erase my temporary internet files with a single click of the mouse, but am running into trouble.

First of all, for those of you who don't know the first thing about batch files:
-you save them as .bat An example is filenumberone.bat
-They have about 8 basic commands that are fairly easy to learn.
-by executing a batch file, you can do several things at once.

Now, right now, I'm just in the testing phase, so I created a directory.

C:\Documents and Settings\Administrator\Desktop\Master\TESTMAIN\TES TSUB

The command I'm using in the batch file (erase.bat) is

del C:\Docume~1\Admini~1\Desktop\Master\TESTMAIN\TESTS UB

The reason I changed the first two directories with a ~1 at the end is because batch files are run through DOS. DOS does not like file names with more than 8 characters. It automatically recognizes the files in their abreviated form.

Now, this works, but it only deletes files IN the directory. What I'm wanting to know is if there is a way to delete the actual FOLDERS - not just the files inside the folders.

Any ideas?

Darkware 07-11-2003 02:46 AM

nevermind. I figured it out. I needed the deltree command, but that particular command is not in windows 2000, so I have to stick /s /q at the end of RD C:\docume~1 blahblahblah

Stick around though. I might have some other problems that need fixing. lol

dave_baer 07-11-2003 08:53 AM

Interesting... Could you post the batch files?

Darkware 07-11-2003 10:19 PM

Here's how you make your own batch file. It's really simple.

-Open Notepad.
-type:

@ECHO OFF
RD C:\Docume~1\Admini~1\Desktop\Master\TESTMAIN\TESTS UB /s /q
CLS

-File>Save As..... name of file here.bat

The echo command is really unessesary since it happens in the blink of an eye anyway. The RD stands for "remove directory." Then you have the file path which is C:\Docume~1\Admini~1\Desktop\Master\TESTMAIN\TESTS UB The /s removes all directories and files in the specified directory in addition to the directory itself. It is used to remove a directory tree in other words. /q is "quit mode" which is like "no questions asked." It does whatever command you typed before it without asking you "Do you really want to delete this file?"

That's about it though. If you really want to piss someone off, you could do exactly what I described above, only have it delete another more important file on a computer. I don't know if it would do it or not while a user is actually running Windows, but you could have it delete the actual windows file for instance. What's more is that you can stick this on a CD with an autorun file. You can have the autorun file automatically execute the batch (.bat) file and "poof!" the files are deleted just as soon an the computer spins the CD up. You can add asteriks to your file paths to add some varience to your collection of files to delete if you like as well.

But ummm *cough* you shouldn't be doing stuff like this anyway, so I'll shut up. Seriously, although doing this with autorun and batch files is a common thing (especially in my tech class at school) you really shouldn't go around doing this to people. Usually, if I were going to do this, it would only be to erase the same files on several computers at school or a workplace that are corrupted from a virus or are no longer needed. This is a very useful thing to know if you're doing stuff like that.

Darkware 08-11-2003 06:33 AM

ok, I'm trying to do something else now, but I doubt it can be done with a batch file.

I want to be able to type out a document, then run a batch file that will change the character "a" to "f", "b" to "x", etcetc for every character to encrypt it. I know you can go into MS Word and do control+h to bring up the "replace" window, but I don't want to have to type everything out each time I want to do this.

So, my question is..... is there some kind of "replace a with b" syntax with a replace command to do what I described above that will go into a batch file?

Thanks in advance.

Zyk0tiK 08-11-2003 08:33 AM

hey you dont want to use a deltree or eqquivilent. else it'll delete the whole folder, if you're deleting the temp intarrwebb files then the folder isn't a good thing to delete :|

Darkware 08-11-2003 03:49 PM

yeah I know. deltree isn't fn Windows2000 so you have to use RD. RD only romoves the folder contents and the folder itself if you have /s at the end.

Zyk0tiK 09-11-2003 01:58 AM

you dont ever wanna remove the folder itself...

Darkware 09-11-2003 02:02 AM

unless you're doing what I described earlier with deleting entire files with the directories they're in like Windows. Of course, that's only if you want to really piss someone off.....

But, there are times you will want to delete the actual folder with all its content included.


All times are GMT. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018