Page 1 of 1

Batch File Troubles

Posted: Mon Apr 03, 2006 10:57 pm
by Kills On Site
In class we have this program called Wave Interactive, it contains tests questions similiar to those on the A+ Exam. The program, Wave Interactive, saves a file called Student.mdb that stores all the test taken information, grades and whatnot. Well this is only useful for the days we take the test then we want to start with a clean slate. Currently we just reinstall the program, it is fairly simple and quick. However I wanted to create a batch file that would automatically delete and copy over a blank slate stored elsewhere on the drive. So far this is what I have
echo off
cd\
cd Program Files
cd Wavetech
cd tests
del Student.mdb
cd..
copy Student.mdb C:\Program Files\Wavetech\tests
exit


As you can see the file is at C:\Program Files\Wavetech\tests\Student.mdb for the clean slate I stored it one level up at C:\Program Files\Wavetech\Student.mdb . My batch file deletes the original just fine, but it won't copy over the clean slate file. All machines are running Windows XP Pro and when we test we are logged in as administrator. Can anyone help me, I consulted Computer Hope with no luck.

Posted: Mon Apr 03, 2006 11:03 pm
by Kills On Site
When I alt- print screen in full screen of a dos promt, with the echo and exit deleted, I get this.

C:\Documents and Settings\Tedder Roberts\Desktop>test.bat

C:\Documents and Settings\Tedder Roberts\Desktop>cd\

C:\>cd Program Files

C:\Program Files>cd Wavetech

C:\Program Files\Wavetech>cd tests

C:\Program Files\Wavetech\tests>del Student.mdb

C:\Program Files\Wavetech\tests>cd..

C:\Program Files\Wavetech>copy Student.mdb C:\Program Files\Wavetech\tests
The syntax of the command is incorrect.

C:\Program Files\Wavetech>

However I don't know what is incorrect.

Posted: Mon Apr 03, 2006 11:10 pm
by Tormentius
The command prompt doesn't interpret spaces in a path without placing the path in quotes.

Posted: Tue Apr 04, 2006 3:16 am
by Kills On Site
Thanks Tormentius, works now.

Posted: Tue Apr 04, 2006 4:34 pm
by Tormentius
Kills On Site wrote:Thanks Tormentius, works now.

You're welcome.

Re: Batch File Troubles

Posted: Wed Apr 05, 2006 3:59 am
by raw
I'd make the script a tad more efficient like this...

Code: Select all

@ECHO OFF
del "C:\Program Files\Wavetech\tests\Student.mdb"&copy "C:\Program Files\Wavetech\tests\Student.mdb" "C:\Program Files\Wavetech\tests\"
exit

Posted: Wed Apr 05, 2006 10:15 pm
by AmIdYfReAk
or use AutoIT V3 :)

Posted: Thu Apr 06, 2006 1:57 am
by raw
Real admins script. ;)

Posted: Fri Apr 07, 2006 11:02 pm
by AmIdYfReAk
that is a scripting program, and it enables you to do a little more then BAt's :)

Posted: Fri Apr 07, 2006 11:39 pm
by +JuggerNaut+
AmIdYfReAk wrote:that is a scripting program, and it enables you to do a little more then BAt's :)
script kiddie.

Posted: Sat Apr 08, 2006 1:30 am
by Silicone_Milk
+JuggerNaut+ wrote:
AmIdYfReAk wrote:that is a scripting program, and it enables you to do a little more then BAt's :)
script kiddie.
:olo: