Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch File doesn't run

Status
Not open for further replies.

ohmbru

Technical User
Joined
Jul 13, 2001
Messages
161
Location
US
I am having trouble getting a batch file to work. File contains simple commands (del, move). The commands do not execute when I run the .bat file but are formatted correctly as they run in MSDOS.

I'm sure there is something basic I'm missing. Where can I begin to troubleshoot this?

Thanks,

Brian
 
Hi,

I think we need a little more detail. Can you post your BAT file contents?



Joseph L. Poandl
MCSE 2000

If your company is in need of experts to examine technical problems/solutions, please check out
 
Here is the .bat file contents. The problem seems to be associated with the directories. I say that because these same commands run in another directory.

del s:\shared\csmeas~1\pending\current.txt
del /q s:\shared\csmeas~1\pending\new\*.*
copy s:\shared\pending\*.dat s:\shared\csmeas~1\pending\newcopy s:\shared\pending\*.gal s:\shared\csmeas~1\pending\newcopy s:\shared\pending\*.hlc s:\shared\csmeas~1\pending\newcopy s:\shared\pending\*.psl s:\shared\csmeas~1\pending\newcopy s:\shared\csmeas~1\pending\new\*.* s:\shared\csmeas~1\pending\current.txt
Move s:\shared\pending\*.dat s:\shared\pending\newMove s:\shared\pending\*.gal s:\shared\pending\newMove s:\shared\pending\*.hlc s:\shared\pending\newMove s:\shared\pending\*.psl s:\shared\pending\new\ Brian
 
break it down!
start you batch process line by line and rem'ing everything out. see if it executes properly. then move on to the next line and so on.
try using the xcopy rather than the copy command.
 
I have broken this down and could not get past the second line (del /q s:\shared\csmeas~1\pending\new\*.*). One thing I noticed was the files I'm trying to delete have different attributes (AC) than the ones in the other directory I referred to.

I will certainly try the xcopy as you suggest, but need to to get past this del command first. Sorry I did not provide this detail initially.

Thanks,


Brian
 
I'm not getting any erros that I could detect. The MSDOS screen flashes quickly. I put the 2nd line in a .bat file by itself and tested it. The files are still there so I know it didn't work.
Brian
 
Try putting a PAUSE after the DEL command whilst remming out any @ECHO OFF commands if you have them. This way, any errors will still be on screen whilst it waits for a key to be pressed. "It's true, its damn true!"
 
OR ...Run the BAT from a DOS command shell instead of double clicking it in Windows Explorer. Joseph L. Poandl
MCSE 2000

If your company is in need of experts to examine technical problems/solutions, please check out
 
How do I run it from a DOS command shell? Brian
 
- Hit the START button
- Goto RUN
- type CMD (If NT) or COMMAND (if Window 9x)

change the directory to where your bat file is located. and then run the bat file by typing its name.

Joseph L. Poandl
MCSE 2000

If your company is in need of experts to examine technical problems/solutions, please check out
 
It worked. I don't understand it, but it worked. It also executed correctly when called from my MS Access database. Thanks.

On a side note, can I specify files that have a modified date within a range?



Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top