Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 20th, 2006, 12:22 AM   #1
NightShade01
Programmer
 
Join Date: Oct 2005
Posts: 52
Rep Power: 3 NightShade01 is on a distinguished road
Batch Question

i'm not sure if this is the right spot for this question but i wasn't sure where else to put it....

I'm trying to make a very simple batch file that will execute within a vb.net program i'm writing. I want to be able to click a button (in vb) and it will execute a batch file that simply copies one file in a folder location to another.
I'm getting all these errors though that the file's invalid, then it couldn't find it. I'm not sure what i'm doing wrong here....

Example:
defs.bin :: is the file example

copy C:\Program Files\defs.bin C:\Program Files\My Program\defs.bin
NightShade01 is offline   Reply With Quote
Old Jun 20th, 2006, 12:54 AM   #2
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Quote:
Originally Posted by NightShade01
copy C:\Program Files\defs.bin C:\Program Files\My Program\defs.bin
The copy command takes 2 arguments.

copy [sourcefile] [destinationfile]

When you put a space in "program files" it, doesn't read properly. It's why you are having problems.

this is what you need: c:\Progra~1\file.bin

Check this out :
http://www.ericphelps.com/batch/lists/filelist.htm
Booooze is offline   Reply With Quote
Old Jun 20th, 2006, 4:13 PM   #3
NightShade01
Programmer
 
Join Date: Oct 2005
Posts: 52
Rep Power: 3 NightShade01 is on a distinguished road
Thanks for the info i read through the site but when i tried to make a slightly more complex batch file i kept getting errors....not sure what i'm still doing wrong. Actual files being used

COPY /-y C:\Program Files\EMC\Anti Virus Updates.bin C:\Program Files\Anti Virus

Which i re wrote as :

COPY /-y C:\Progra~1\EMC\Anti Virus Updates.bin C:\Progra~1\Anti Virus
NightShade01 is offline   Reply With Quote
Old Jun 20th, 2006, 5:39 PM   #4
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Quote:
COPY /-y C:\Progra~1\EMC\Anti Virus Updates.bin C:\Progra~1\Anti Virus
You still have spaces in there. You should really avoid using spaces in filenames. It makes things a pain in the ass for batch files. I always just avoided it.
Booooze is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:01 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC