Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Help with a Dos batch file
Closed Thread
Old 02-11-2008, 01:04 PM   #1 (permalink)
Jakes55's Avatar
 
Newb Techie

Join Date: Feb 2008

Posts: 1

Jakes55 is on a distinguished road

Default Help with a Dos batch file

Greetings All,

I am currently trying to write a batch file that will find a specific folder, change directories to that folder the run a specific command. All the research that I have done on dos commands and batch files has come up empty.

This really would not be that difficult if our program (that this batch file will be used to fix) was installed to the normal program directory. Of course, it does not. It was built using .Net Framework 2.0 and uses the Click-once technology to install it. The installation is user profile based (meaning it installs to the current windows user profile). The path itself will be somewhat the same for all installs but different enough to give me problems with this file (I am a dos noob btw :-/)

The path of the folder that I need to be in looks something like this:

C:\Documents and Settings\(windows username)*\Local Settings\Apps\2.0\.....\(folder that need to be in)

*any help with a wild card here that would place the windows username here would also be appriciated.

Any help any could give would be greatly appreciated.


Thanks


Jake
Jakes55 is offline  
Old 02-11-2008, 09:25 PM   #2 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default Re: Help with a Dos batch file

Code:
 %userprofile%\local settings\apps\2.0\...\folder

__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 03-02-2008, 09:04 PM   #3 (permalink)
 
Newb Techie

Join Date: Nov 2007

Posts: 23

SpenceQ is on a distinguished road

Default Re: Help with a Dos batch file

OK, first here is a snippet of code from a high level language that will recursively go through the directories. So if your looking for that you can convert it to any language you want. I think this is Clipper but can't be sure. I couldn't find reference in the code for the mentioned filedelete() function, but I imagine it does the work when a directory hit is made, I think it's a UDF. Table is an array. Some functions are base program functions (DELFILE,DIRECTORY) I can't really say, but when you use your language just use the equivalent.

The problem with DOS is not doing the work, that it will do without any problems. The problem is when it needs to talk to you and your calling it from a VBasic or something. So I think you will need to pipe a "Y" before your command so you don't get a "Delete Yes or N?" or something like that. Something like if you were copying over an existing file, dos would ask you if that's OK, so you would say:

"Y" | copy xxxxx to cccccc

you'll need to check the syntax in windows to get the right syntax.

Meanwhile, I'll find the same thing for DOS. I have a gazillion examples of DOS, even how to compile a batch file to make an exe, so it'll take me time to research.

function delfile(cur_path)
local table := {}, i

filedelete(cur_path +"*.*",0)
table := DIRECTORY(cur_path+"*.*","D")
if len(table) > 0
for i := 1 to len(table)
if !(left(table[I,1],1) $ ".")
DELFILE(cur_path + table[i,1] + "\") //Recursive to reach the
dirremove(cur_path+ table[i,1]) // lowest sub-directory
endif
next
endif

return nil


Last edited by SpenceQ; 03-02-2008 at 09:11 PM.
SpenceQ is offline  
 
Closed Thread

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
WTF is a Bad Block? MikesCreation Hardware Troubleshooting 18 02-24-2008 09:31 PM
Batch scripting: Startup applications and close batch file LincolnX Windows Operating Systems and Software 7 01-17-2008 08:50 PM
Hard Drive Errors!!! Bad or Faulty HDD? mike4realz Hardware Troubleshooting 3 09-19-2007 01:56 AM
seagate 80gigs failing.. acuariano Hardware Troubleshooting 27 08-27-2007 10:43 PM
Another Hijack Log boo HijackThis Logs (finished) 17 06-26-2007 12:30 PM