batch

Script or util to remove old backups

I'm creating a backup strategy for a sharepoint server I'm setting up. Have got a backup running daily. In the long term I'd like to keep: * Daily backups for the last week. * Weekly backups for the last month. * Monthly backups for the last year. * Yearly backups. If I was writing in bash/cygwin I would find it fairly easy to write...

Batch file to read ini

I am trying to automate editing the boot.ini depending on the partition XP loads from. This is a snippet of the batch I am working on. One minute it works and the next it fails. It doesn't always correctly read from the boot.ini Any suggestions ? @echo off find "multi(0)disk(0)rdisk(0)partition(1)\WINDOWS" boot.ini | sort /r | date ...

Calling python script on MAC/Linux from Command line - passing arguments

Consider this setup and folder structure: c:\foo \bin\foo.bat \lib\foo.py I have foo.bat path added to my environment PATH, so I can call it from anywhere passing in some arguments: c:/>foo.bat -v foo.bat contains this code: @ECHO OFF "c:\foo\lib\foo.py" %1 %2 %3 %4 %5 %6 %7 %8 %9 This works fine in Windows. Now I ...

Looking for unix style 'getopt' command line parsing in a windows/dos batch file

Can anyone help me find something to parse command line args in a dos batch file like one would do in a unix shell script using getopt/getopts? It doesn't have to be all posix-y; just something that I can specify what switches I expect, which of them require/allow an argument. They don't need to be "long" switches; single characters wi...

Copy new files only in batch

I have looked over the copy and xcopy batch commands. Both of them do not seem to support "copy new files only regardless file date time - name comparing only" option. Please advise. ...

batch script to find last two days from the current date

Hi All, I am in a project where I need to find all files which are two days lesser than the current date. How can we achieve this using a batch script in Windows? Appreciate your help ! Regards, Renju. ...

Detect Internet Connection down in windows using batch programming ?

I'm using net conn .which goes down after sum time bt if i repair my connection it works fine , i hv to do it manually always.... i want to do this task automatically. so i want to make a batch file in windows which will constantly running in background . and when my Internet network connection will down it will renew my connection and ...

How do I create and execute batch file in client machine using server side code?

Hi, I googled and searched for information regarding the title but most of them couldn't help much. I need your advise. Is this possible or is there any other way to do this? FYI, the server is running on Unix OS and clients are all running on Windows OS. Thanks in advance! I really appreciate your precious advise. ...

.bat file behaves wrong from command line

I have a .bat file that simply opens up two different browsers and points them to unique links. After it opens up the first browser, it waits a few seconds, then opens up the second browser. What I expect to happen is that the second browser's window will automatically be focused and active. This behavior only happens when I click on the...

zip a folder with exceptions of few particular files through batch

Hi there, I tried to find the answer to this in several places and failed, so here it goes: I have a directory, say, "Project" which has a lot of sub directories and files. I want to make a batch program which just zips this Project directory. But also, I want to skip just a few particular files and just one folder. I figured that I ...

Batch File to write to event viewer.

I have a batch file that runs a richcopy program, I am wanting to monitor the errorlevel so far i have got this IF (%ERRORLEVEL% == 0) goto OK else IF (%ERRORLEVEL% == 3010) goto Report :Report :OK END What I am wanting to do is to report the error to the event viewer so that it can be monitored via another application that monitor...

How do you get the newly added entry's URL if you are using batch operation on Contacts Provider

If you are using incremental approach in adding a record to Contacts Data table, after an insertion, you get the URL of the newly added record so that you can perform query or update operation. Now if you are using batch operation like following, how do you get the reference to the newly added record? // Create RawContacts...

Python + MySQLDB Batch Insert/Update command for two of the same databases.

Hi all, I'm working with two databases, a local version and the version on the server. The server is the most up to date version and instead of recopying all values on all tables from the server to my local version, I would like to enter each table and only insert/update the values that have changed, from server, and copy those value...

How can i send my emails and perform some other tasks in batches using php

I run a website and my subscriber base is gradually increasing. I had to manually batch my subscribers, that is Batch A (1-700), Batch B (701 - 1400) etc. and manually trigger the email sending every hour. In addition, to sending them emails i want to perform some other tasks along side the email. I believe there should be a way of ...

How to add prefix or postfix to rename batch file?

Hi I've created a rename batch file and it takes 3 arguments and renames files inside a folder The batch file script is @echo off&set /a cnt=1 set arg1=%1 set arg2=%2 set arg3=%3 for %%a in (%arg1%\%arg2%) do call :PROCESS "%%a" goto :EOF :PROCESS rename %1 %arg3%%cnt%.* set /a cnt+=1 Eg syntax is: rename.bat e:\ranks\Ranks *.gif ...

How to get a BATCH file executed from a web page?

Hi All, I have a one line batch file that I want to call from a web page via a button what is the best way to achieve this? The BATCH File is as follows: c:\R\bin\Rscript.exe "c:\Users\user\Desktop\Shares.R" Or is it possible just to call the R script straight from the web page and skip the BATCH file altogether, Can this be done? I...

Pausing a batch file when double-clicked but not when run from a console window?

Is there a way for a batch file (in this case, running on Windows XP) to determine whether it was launched from a command line (i.e. inside a console window) or launched via the shell (e.g. by double-clicking)? I have a script which I'd like to have pause at certain points when run via the shell, but not when run at a command line. I'v...

Windows batch R Sweave error loading packages

I am having trouble finding clear documentation on how to set up a batch file for a Sweave document on Windows XP. I am using the batch files that are found here I have created a batch file names run.bat which contains the following: Sweave myFile.Rnw The first thing I do in my Sweave file after setting the wd is read in a dataset ...

Triggering taskbar button flash from batch file?

Is it possible to trigger Windows' "flash the task bar button X times or until the window comes to the foreground" behavior from a batch file? I'm trying to call the user's attention to a long-running script upon completion. Using an external program to trigger the flashing is fine, as long as it doesn't require an install (i.e. the ex...

SharePoint Batch Update Auto Increment Field Value

Hello All, I am making use of SharePoint List Batch Updating methodology in order to update the items in bulk. I build the query dynamically for each and every item using StringBuilder and process the data ultimately using 'ProcessBatchData' Method. Now, I have a requirement where I have to increment a particular field value in the que...