Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrading DOS Batch files for Windows

Has anyone had any recent requirements for programming automated DOS Batch style tasks on a Windows box?

I've got some automation to do and I'd rather not sit and write a pile of .BAT files in Notepad if there is a better way of automating these tasks: mainly moving of files under certain date and time conditions, as well as triggering Windows applications before and after moving the files.

I am thinking along the lines of an IDE that has all the DOS commands 'available' to the editor with the correct parameter syntax checking. Is there anything like this out there, or should I be solving this problem with something other than .BAT files?

like image 407
Geek Avatar asked Sep 28 '08 20:09

Geek


1 Answers

For simple Windows automation beyond BAT files, VBScript and Powershell might be worth a look. If you're wondering where to start first, VBScript+Windows Task Scheduler would be the first place I'd start. Copying a file with VBS can be as simple as:

Dim objFSO

Set objFSO = CreateObject ("Scripting.FileSystemObject")
If objFSO.FileExists("C:\source\your_file.txt") Then
    objFSO.CopyFile "C:\source\your_file.txt", "C:\destination\your_file.txt"
EndIf
like image 126
Bullines Avatar answered Nov 14 '22 21:11

Bullines