Jump to content
dralarms

Dos guru needed

Recommended Posts

I need help with a simple batch file. I can do batch files to do what I need but I need a timed batch file. Here’s what I’m trying to do:

 

copy c:\alarms\*.* c\backup\*.*

 

but I need it to run twice a day

Share this post


Link to post
Share on other sites

If can can put together the .bat file, just use Windows Task Scheduler to execute it whenever you want.  I would also recommend robocopy rather than a simple copy command as is far more powerful.

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
15 minutes ago, Garufa said:

If can can put together the .bat file, just use Windows Task Scheduler to execute it whenever you want.  I would also recommend robocopy rather than a simple copy command as is far more powerful.

Brilliant 

Edited by dralarms

Share this post


Link to post
Share on other sites
4 minutes ago, DaveTN said:

If you are trying to run it in windows 7 or later; maybe this will help.

https://www.computerhope.com/issues/ch000785.htm

I wish,

 

it’s a windows 98 machine running a dos based program. It will cost me over 3000.00 to upgrade the program (in addition to the computer cost).

Share this post


Link to post
Share on other sites

Task Scheduler Should be in Control Panel if I remember correct.

 

Or in the DOS batch you can try 

TIMEOUT /T 10 /NOBREAK

Where 10 is the Number of seconds to wait before going on.That and a loop woukd manually do it if you left it running.

 

So try this. Not sure if 43200 is too large but that is 12x60x60 So 1/2 day. Rough memory here too. 

 

=========

START

copy c:\alarms\*.* c\backup\*.*

TIMEOUT /T 43200 /NOBREAK

GOTO START

===========

 

Share this post


Link to post
Share on other sites
1 minute ago, Ronald_55 said:

Task Scheduler Should be in Control Panel if I remember correct.

 

Or in the DOS batch you can try 


TIMEOUT /T 10 /NOBREAK

Where 10 is the Number of seconds to wait before going on.That and a loop woukd manually do it if you left it running.

 

So try this. Not sure if 43200 is too large but that is 12x60x60 So 1/2 day. Rough memory here too. 

 

=========

START

copy c:\alarms\*.* c\backup\*.*

TIMEOUT /T 43200 /NOBREAK

GOTO START

===========

 

I appreciate your help. I just used the tack scheduler to run the batch files I created. 

Share this post


Link to post
Share on other sites
2 minutes ago, dralarms said:

I wish,

it’s a windows 98 machine running a dos based program. It will cost me over 3000.00 to upgrade the program (in addition to the computer cost).

Been there done that, and still have the T-shirt. And I wouldn’t gain anything by spending those thousands to upgrade.

Glad you found an answer.

Share this post


Link to post
Share on other sites
14 minutes ago, DaveTN said:

Been there done that, and still have the T-shirt. And I wouldn’t gain anything by spending those thousands to upgrade.

Glad you found an answer.

Oh the upgrade would benefit me but I just can’t swing it. 

Share this post


Link to post
Share on other sites

Everything is working great now but it’s leaving open boxes up. How can I force the boxes closed?

Share this post


Link to post
Share on other sites

Do you have a pause in the batch?

Share this post


Link to post
Share on other sites
Posted (edited)

I don't know exactly what the operating structure for the "Alarms" directory is, but you may or may not consider implementing a variable = today, mkdir variable, and then copy everything into that new directory. Your backups directory would have a long list of directories by date and then copies within for all the files. This would only be really beneficial if the files change sometimes and if you may want to go back to look at previous versions. If the files are large, though, it'll compound linearly everyday.

I'm more experienced in Bash scripting than writing batch files on Windows, and even though the concept is the same I wouldn't be the exact person to look at for a Windows 98 environment.

I don't know that it would work, but I'd write something like this.

https://pastebin.com/z1VQmXXW

I'm on a Mac right now with no access to a Windows computer, I wouldn't expect any of that to work properly but I put it together quickly just to give an idea of what could be done.

I do have a Windows computer at home and everytime I exit Adobe Lightroom it automatically creates a backup of its database. The backups get stuck in my Dropbox folder. However, the backups do end up taking decent space eventually.

My solution? I wrote a batch file to automatically find those backups in that directory older than 14 days and delete them. I threw it in the Startup folder on Windows 10. As such, it automatically purges those backups older than 14 days when I boot the computer.

Again, just ideas of what can be done.

Edited by GlockSpock

Share this post


Link to post
Share on other sites
2 hours ago, dralarms said:

Everything is working great now but it’s leaving open boxes up. How can I force the boxes closed?

How are you running it? Via task scheduler, via cmd, or clicking the batch file?

No issue in adding the following line to the very end/exit of the batch file:

exit

Share this post


Link to post
Share on other sites

Yew guys is smart . . .  

  • Haha 1

Share this post


Link to post
Share on other sites
18 minutes ago, GlockSpock said:

How are you running it? Via task scheduler, via cmd, or clicking the batch file?

No issue in adding the following line to the very end/exit of the batch file:

exit

I have the exit command already in place, but it’s not closing the dos window. That’s all I’m trying to accomplish now. I’m running 14 different batch files, 12 of them on odd hours, into 12 different directory’s , and the other 2 at 8am and 8pm, also in separate directory’s, It’s just leaving 14 windows open a day, I can close them manually but would like it it they closed automatically. 
 

file size is not a problem, all 14 directory’s are less than 1 meg, I think

Share this post


Link to post
Share on other sites
1 hour ago, dralarms said:

I have the exit command already in place, but it’s not closing the dos window. That’s all I’m trying to accomplish now. I’m running 14 different batch files, 12 of them on odd hours, into 12 different directory’s , and the other 2 at 8am and 8pm, also in separate directory’s, It’s just leaving 14 windows open a day, I can close them manually but would like it it they closed automatically. 
 

file size is not a problem, all 14 directory’s are less than 1 meg, I think

Quote

 

MS-DOS 7.* (Windows 9x)Make sure no text is displayed in the console window to make it close automatically at the end of the batch file

https://www.robvanderwoude.com/exit.php

 

Does this help?

Share this post


Link to post
Share on other sites
42 minutes ago, DaveTN said:

Does this help?

Clear as mud. Tells you what to do without telling you how to do it. 😂 

Share this post


Link to post
Share on other sites
7 minutes ago, dralarms said:

Clear as mud. Tells you what to do without telling you how to do it. 😂 

Try

@echo off (at the beginning of the file)

and CLS prior to the EXIT command

:confused:

Share this post


Link to post
Share on other sites
1 hour ago, DaveTN said:

Try

@echo off (at the beginning of the file)

and CLS prior to the EXIT command

:confused:

Thanks. That seems to work

  • Wow 1

Share this post


Link to post
Share on other sites

I love scripting things. It’s something probably 90% of people never attempt or even know is possible. But you can automate so many things with a bit of research. 

  • Like 3

Share this post


Link to post
Share on other sites
Posted (edited)
28 minutes ago, GlockSpock said:

I love scripting things. It’s something probably 90% of people never attempt or even know is possible. But you can automate so many things with a bit of research. 

I love scripts. We are setting up new pcs with Windows 10 at work and I have developed batch files to activate office, add local users, delete files, and even remove bloatware from Windows 10. Even if you habe to run them manually, it saves so much time

Edited by Ronald_55
Spelling..what else..

Share this post


Link to post
Share on other sites

all i can say is wow a windows 98 machine still in use in 2020

Share this post


Link to post
Share on other sites
23 minutes ago, luke9511 said:

all i can say is wow a windows 98 machine still in use in 2020

That’s nothing, it’s actually a dos program that I run in a Windows 98 dos prompt. 😂 

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, luke9511 said:

all i can say is wow a windows 98 machine still in use in 2020

There is a small independent Verizon dealer near me that has Windows 3.1 on his main terminal at the counter.

As I've mentioned before, I have one customer still running Windows 98 with sign cutting software on it.

  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

The Fine Print

Tennessee Gun Owners (TNGunOwners.com) is the premier Community and Discussion Forum for gun owners, firearm enthusiasts, sportsmen and Second Amendment proponents in the state of Tennessee and surrounding region.

TNGunOwners.com (TGO) is a presentation of Enthusiast Productions. The TGO state flag logo and the TGO tri-hole "icon" logo are trademarks of Tennessee Gun Owners. The TGO logos and all content presented on this site may not be reproduced in any form without express written permission. The opinions expressed on TGO are those of their authors and do not necessarily reflect those of the site's owners or staff.

Before engaging in any transaction of goods or services on TGO, all parties involved must know and follow the local, state and Federal laws regarding those transactions. TGO makes no claims, guarantees or assurances regarding any such transactions.

×
×
  • Create New...

Important Information

By using this site, you agree to the following.
Terms of Use | Privacy Policy | Guidelines