Jump to content

Dos guru needed


dralarms

Recommended Posts

Posted

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

Posted

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
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
Posted

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

===========

 

Posted
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. 

Posted
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.

Posted
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. 

  • Moderators
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
  • Moderators
Posted
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

Posted
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

Posted
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?

Posted
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:

Posted
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
  • Moderators
Posted

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
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..
Posted
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
Posted
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

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

TRADING POST NOTICE

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.

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.

TNGunOwners.com (TGO) is not a lobbying organization and has no affiliation with any lobbying organizations.  Beware of scammers using the Tennessee Gun Owners name, purporting to be Pro-2A lobbying organizations!

×
×
  • Create New...

Important Information

By using this site, you agree to the following.
Terms of Use | Privacy Policy | Guidelines
 
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.