Author Topic: Batch File  (Read 1572 times)

Offline CaptainRussell

  • Posts: 166
  • Cookies: 25
Batch File
« on: April 09, 2008, 11:34:12 PM »
Could some one tell me how to make a batch file that will delete the following directories:

"scripts/Tactical/Projectiles"
"scripts/ships"
"scripts/Maelstrom"
"data/Models/Ships"
"data/Models/SharedTextures"
"data/Models/Bases"
"data/Models/Misc"
"data/Icons/Ships"
"sfx/Explosions"
"sfx/Weapons"

Your help would be greatly appreciated as I have not been able to find a decent batch file tutorial.

Thanks!

-CR

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Batch File
« Reply #1 on: April 10, 2008, 12:21:07 PM »
/? is all the tutorials you need. ;)

If you place this in your BC directory, then it ought to work, not sure though.

Code: [Select]
del .\scripts\Tactical\Projectiles
del .\scripts\ships
del .\scripts\Maelstrom
del .\data\Models\Ships
del .\data\Models\SharedTextures
del .\data\Models\Bases
del .\data\Icons\Ships
del .\sfx\Explosions
del .\sfx\Weapons

What are you trying to do anyway?
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline JimmyB76

  • Posts: 6423
  • Cookies: 421
Re: Batch File
« Reply #2 on: April 10, 2008, 01:39:55 PM »
somehow methinks it has to do with BC SuperMod 3.0 ;)

Offline CaptainRussell

  • Posts: 166
  • Cookies: 25
Re: Batch File
« Reply #3 on: April 10, 2008, 03:30:09 PM »
Thanks MLeo; I'll try that.

Jimmy, you get a cookie.

-CR

Offline JimmyB76

  • Posts: 6423
  • Cookies: 421
Re: Batch File
« Reply #4 on: April 10, 2008, 05:07:30 PM »
cookie right back at ya - i know how hard youve been working on it :)

Offline CaptainRussell

  • Posts: 166
  • Cookies: 25
Re: Batch File
« Reply #5 on: April 10, 2008, 08:17:52 PM »
Well that didn't work; people are going to have to delete about ten folders from their fresh BC installation - I have already prepared a pictorial instruction reference so it should not be very difficult.

I know how to make the batch file that could do this, but the user would have to press "y" and "Enter" about 1000 times to get through the damn thing - I think it would be easier for them to just delete the folders manually.

-CR

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Batch File
« Reply #6 on: April 11, 2008, 07:23:40 AM »
Have you tried adding /Q and /F just after each path?
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline CaptainRussell

  • Posts: 166
  • Cookies: 25
Re: Batch File
« Reply #7 on: April 11, 2008, 10:05:34 AM »
Nevermind I looked up those commands on a tutorial.

MLeo, I think that it should go something like this:

rmdir /S /Q C:\Program Files\Activision\Bridge Commander\data\Models\Ships
rmdir /S /Q C:\Program Files\Activision\Bridge Commander\data\Models\Bases
rmdir /S /Q C:\Program Files\Activision\Bridge Commander\data\Models\SharedTextures
rmdir /S /Q C:\Program Files\Activision\Bridge Commander\data\Models\Misc
rmdir /S /Q C:\Program Files\Activision\Bridge Commander\data\Icons\Ships
rmdir /S /Q C:\Program Files\Activision\Bridge Commander\scripts\Tactical\Projectiles
rmdir /S /Q C:\Program Files\Activision\Bridge Commander\scripts\Ships
rmdir /S /Q C:\Program Files\Activision\Bridge Commander\scripts\Maelstrom
rmdir /S /Q C:\Program Files\Activision\Bridge Commander\sfx\Weapons
rmdir /S /Q C:\Program Files\Activision\Bridge Commander\sfx\Explosions

A good site said that /Q will prevent the question prompt, and /S will remove all files, subdirectories, and subdirectory files; I'm at school right now so I won't be able to find out if the above code works for several hours. :(

Thanks though.

-CR

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Batch File
« Reply #8 on: April 11, 2008, 11:08:44 AM »
You will need to put "" around the path, since it contains spaces.


The . means "current directory" (.. would mean parent directory).


So, changing the working directory to the BC install would make the above valid, to an extend, rmdir could also work.

rmdir does seem to be a better candidate instead of del for this job.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline CaptainRussell

  • Posts: 166
  • Cookies: 25
Re: Batch File
« Reply #9 on: April 11, 2008, 11:51:28 AM »
Thanks I was not sure about spaces in DOS as far as folders are concerned; so it should go like this:

rmdir /S /Q "C:\Program Files\Activision\Bridge Commander\data\Models\Ships"
rmdir /S /Q "C:\Program Files\Activision\Bridge Commander\data\Models\Bases"
rmdir /S /Q "C:\Program Files\Activision\Bridge Commander\data\Models\SharedTextures"
rmdir /S /Q "C:\Program Files\Activision\Bridge Commander\data\Models\Misc"
rmdir /S /Q "C:\Program Files\Activision\Bridge Commander\data\Icons\Ships"
rmdir /S /Q "C:\Program Files\Activision\Bridge Commander\scripts\Tactical\Projectiles"
rmdir /S /Q "C:\Program Files\Activision\Bridge Commander\scripts\Ships"
rmdir /S /Q "C:\Program Files\Activision\Bridge Commander\scripts\Maelstrom"
rmdir /S /Q "C:\Program Files\Activision\Bridge Commander\sfx\Weapons"
rmdir /S /Q "C:\Program Files\Activision\Bridge Commander\sfx\Explosions"

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Batch File
« Reply #10 on: April 11, 2008, 12:04:34 PM »
Seems alright so far, except for the hardcoded assumption that everyone installs in C:\Program Files\. :P

The only programs that are installed there are programs that are stupid and don't allow anything else. Such as Borland JBuilder which also doesn't want spaces in the installation path. :P
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline CaptainRussell

  • Posts: 166
  • Cookies: 25
Re: Batch File
« Reply #11 on: April 11, 2008, 01:38:55 PM »
I'll just have the user paste the BAT into their "Bridge Commander" folder then, and delete the "C:/Program Files/Activision/Bridge Commander" part off of each of the above remove directory codes.

-CR

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Batch File
« Reply #12 on: April 11, 2008, 03:40:11 PM »
Don't forget to add the dot! ;)

But if you are going with an installer, then why not do it for them?
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline El

  • Master Hardpointer
  • Retired Administrator
  • Posts: 653
  • Cookies: 123
  • Former Vice Admin
Re: Batch File
« Reply #13 on: April 12, 2008, 08:56:15 AM »
I think some of the newer install builder tools allow you to remove existing files/folders if they already exist.
This would probably be a cleaner approach than running a batch file.