I was just going through a primer of batch file programming and wondered how could I do some trivial tasks by batch files like start media player after certain time intervals and things like that? Also does this have anything to do with Windows API?
-
If you add your .bat file to the start up folder then make use of the AT command, this might be what you're after...
http://support.microsoft.com/kb/313565 -
well, batch files are *basically* just a sequence of command-line commands. They can only do what you could do manually by writing on the command line.
So unless you can find a command to schedule a program to start at specific intervals, you're probably out of luck. (Then again, I think Windows does have one or two commands for that, but can't remember what they are)
And no, the Windows API is a set of C/C++ functions that you can call from within your application. Can't be used from the command line (so can't be used in bat files either) -
Thanks for the help. But how can I perform filehandling operations using batch file programming, also is batch programming the best way to perform filehandling on your system?
-
what sort of filehandling operations?
is this the sort of thing?
http://support.microsoft.com/kb/829483/en-us -
As I said, the same way as you would from the command line. Open cmd.exe and type in commands. Batch files are just a batch of those. (Hence the name)
So file handling?
you could do "copy a.txt b.txt" "del c.txt" or whatever. What do you need to do? -
Operations like looking up an image file and loading it as a wallpaper from a folder at periodic intervals and keep changing wallpapers from that folder in given time intervals.
-
even if you find a Timer command (for the intervals) you wouldn't want a normal batch-file for doing that cause it'll probably hog your system .. for not being true multi-tasking , I know there are plenty of freeware's to do what you ask .. im just too lazy to look 4it , try www.software.com or google.
-
If it were me doing something like that I'd do it a slightly different way and create a webpage which cycles through an array of images then enable "active desktop" and pick that webpage as the desktop.
If you don't have any website authoring software I would think you can create a slideshow webpage pretty easily via Word (eek) or Frontpage (another eek!) or you may well find a template online. Try www.htmlgoodies.com the banners are annoying but the content is good! -
ScuderiaConchiglia NBR Vaio Team Curmudgeon
One other way for time specific batch files is to use the task scheduler to fire them off. This is MUCH better than using the batch file "AT" capability, because it does not require loading the batch file into memory at boot time and then having it hang around all the time waiting for the proper moment to do its thing. Task Schdeuler will handle the timing portion very nicely.
Gary -
I was thinking more along the lines of writing a standalone program, could that be done?
-
it's perfectly fine to use the at command to schedule intervals IMO. at command uses the task scheduler
there's no reliable way to change wallpaper though without a separate program.
-
Which programming language would cater to the need here?
-
I'd suggest giving AutoHotkey a try. It's a relatively easy-to-learn scripting language, good for automating tasks and such, and is easily compiled into light-weight executables.
Some things you mentioned like changing the wallpaper might be tricky, I'm not really sure how you'd go about doing that. You could probably ask in the autohotkey forums if/how it could be done. -
Do you know any programming languages?
You could look at tcl or python as alternatives to batch files. -
AKAJohnDoe Mime with Tourette's
I still have an old DOS version of Quercus REXX that still ran under XP (haven't tried it under Vista) that was a nice way to do quick little procedural programming with a non-compiled interpretive language.
-
There is a Windows power shell which is AFAIK CMD on steroid.
Though I would prefer python which is easy to learn and with very good windows support. -
Okay python sounds reasonable, what about vc++?
-
C++ is a lower-level language than the others we've been discussing. It depends on the task... but for most system-scripting type tasks, using C++ would involve more work and make it trickier to debug.
I'm still a bit vague about what you want this program to do though.... -
AKAJohnDoe Mime with Tourette's
You might even be able to use Vista's Task Scheduler for some of the tasks mentioned in the initial post.
-
I am asking about visual c++ from MS, I wanted to write a program that could tweak system appearance on its own from time to time.
-
AKAJohnDoe Mime with Tourette's
Well, have fun then!
-
I'd stay away from C++ (and VC++ is just Microsoft's tool for developing C++). It is a pain to learn, even worse to master, and for what you want to do, I can't think of a less suitable language.
You could try out C# or Visual Basic.Net instead. Both of these are very well integrated into Windows (which means it should be simple to do the tasks you want), and both are much easier and simpler languages to work with.
And of course, Microsoft has free software available for developing in both. -
ScuderiaConchiglia NBR Vaio Team Curmudgeon
Can I get an AMEN brothers and sisters?
Yes stay away from C++, it's powerful but very cryptic. c# or VB.net are much better choices and the express editions as Jalf said are free.
Gary
Batch file programming
Discussion in 'Windows OS and Software' started by orion95, Oct 11, 2007.