batch

Most efficient way to move a few SQL Server tables to SQLite?

I have a fairly large SQL Server database; I'd like to pull 4 tables out and dump them directly into an sqlite.db for remote querying (via nightly batch). I was about to write a script to step through(most likely on a unix host kicked off via cron); but there should be a simpler method to export the tables directly (SQLite not an option...

Windows batch file: Pipe destroys my return code

Hi, is it possible to return the errorlevel also if I pipe the output of a script into a logfile: test1.bat: call test2.bat 2>&1 | tee log.txt echo ERRORLEVEL: %ERRORLEVEL% test2.bat: exit /B 1 Output when calling test1.bat: ERRORLEVEL: 0 The errorlevel is always 0. The problem is, I want to call another script inside my ...

Read ini from windows batch file

I'm trying to read a ini file with this format: [SectionName] total=4 [AnotherSectionName] total=7 [OtherSectionName] total=12 Basically I want to echo out certain values from the ini file(eg. the total under OtherSectionName followed by the total from AnotherSectionName). ...

How to create a .BAT file to download file from HTTP\ftp server?

How to create a .BAT file to download file or folder from FTP server? (and replace with it existing file) (we have links like ftp://me:[email protected]/file.file (or http://example.com/file.file) and absolute file link like C:\Users\UserName\Some mixed Русский English Adress\file.file) (using only native windows (xp vista win7 etc) BAT...

Extract some data from a lot of xml files

I have cricket player profiles saved in the form of .xml files in a folder. each file has these tags in it <playerid>547</playerid> <majorteam>England</majorteam> <playername>Don</playername> the playerid is same as in .xml (each file is of different size,1kb to 5kb). These are about 500 files. What i need is to extract the playern...

Writing a simple batch file to setup a variable?

I want to write a simple batch file where i want to setup a environment variable based on the machine architecture. It is as below: set ARCH=%PROCESSOR_ARCHITECTURE% echo %ARCH% if %ARCH%==x86 ( set JAVA_ROOT=C:\Progra~1\Java\j2re1.4.2_13 ) else ( set JAVA_ROOT=C:\Progra~2\Java\j2re1.4.2_13 ) echo JAVA_ROOT is %JAVA_ROOT% On 64-bi...

How to use a command line parameter to supply input in subsequent prompt (batch file)

I am using batch file to run certain operation in my application. The command I am using does not take password as a parameter instead it prompts for it while running. This is coming in the way of automating this script. I would like to know how I can take password as a parameter and provide to the application when it prompts. ...

Using a batch file to create folder and copy files into it to multiple PCs

Hi, I have a folder with numerous files that I need to copy to multiple PCs on a network. I thought if the folder didn't exist it would automatically create it. Here's what I have... copy "C:\Documents and Settings\follag\Desktop\Music" "\PC NAME\c$\Documents and Settings\All Users\Desktop\Music" When I look at the destination PC, it...

How to create a .BAT file to download and unpack a zip file?

How to create a .BAT file to download and unpack a zip file from HTTP server? We have links like http://example.com/folder.zip and absolute folder link like C:\Users\UserName\Some mixed Русский English Adress\ if files from zip exist in directory owerrite them. using only native windows (xp vista win7 etc) BAT functions and files. C...

How to ignore %% from being evaluated?

Hi, one of my variables has the value %val% - this is exactly the name! So: set variable=%val% What happens now is that when running the script the variable will be set to nothing as the %val% is being evaluated! But this is not what I want... How can I tell DOS to ignore the %-sign here? Can anybody out there help me with my questio...

Windows Server 2003 call to secedit within a batch script generates "C:\Program" on system reboot

In executing secedit /configure /db %~1\tomcat.sdb" /cfg %~1\2003.inf" /log %~1\dtomcat.log" /quiet where %~1 == C:\Program Files\myDirectory\mySubDirectory\mySuperSubDirectory a file titled "C:\Program" is generated and within the file is the output for calling secedit /? I am curious as to why this is occuring because it mak...

Batch file command line arguments

I want to pass a command as a command line argument from one batch file to another e.g. first.bat call test.bat "echo hello world" "echo welcome " test.bat set initialcommand=%1 set maincommand=%2 %maincommand% %initialcommand% ...

How to apply %% to a variable in a script with input parameter?

Hi, I asked a question yesterday about how to manage to get %% around a variable without getting the evaluation. Well, the thing is, it does not work that way in my case... I have a .bat file which gets an input parameter. Later on I want to use the value of this input parameter and put %...% around, like: call script.bat testValue s...

MS SQL - High performance data inserting with stored procedures

Hi. Im searching for a very high performant possibility to insert data into a MS SQL database. The data is a (relatively big) construct of objects with relations. For security reasons i want to use stored procedures instead of direct table access. Lets say i have a structure like this: Document MetaData User Device Content Conten...

exit /B 0 does not work...

Hi, I have the following problem: I have created a batch script which calls itself in there (for being able to write a log in parallel). In the script I start another process (like start startServer.bat) which starts up a java process and keeps opened up all the time. In my original script I wait 30 seconds, check if the process is r...

Batch file to Zip using only whats available to user

I am trying to write a script that I can give to user to have it automatically zip certain files of theirs and then load them onto an ftp site. Anyone know where I could find information on writing a batch file for auto-zipping files using only what is available to a user running windows? I have been looking for quite a bit but I am st...

How to create a .BAT file opening programm and preventing it from opening new windows?

So I am starting a consol programm from .bat file. I want it to run as a process but not showing any windows. How to do such thing? ...

How to stop process from .BAT file?

So I have process I started from one bat file. How to stop it from another? ...

How to make .BAT file delete it self after completion?

How to make .BAT file delete it self after completion? I have a simple bat file that terminates a process. I want that .BAT file to delete itself ...

Using file() incrementally?

I'm not sure if this is possible, I've been googling for a solution... But, essentially, I have a very large file, the lines of which I want to store in an array. Thus, I'm using file(), but is there a way to do that in batches? So that every,say, 100 lines it creates, it "pauses"? I think there's likely to be something I can do wi...