batch

runas command in windows 7

Hi, I'm trying to run a batch file as admin. I found that I can use runas command which corresponds sudo command in Linux I think. I tried runas /noprofile /user:computername\adminuser "blah.bat start" But it gives an error, saying : Logon failure: user account restriction.. (msdos window doesn't allow me to coppy damn thing I h...

optimistic locking batch update

How to use optimistic locking with batch updates? I am using SimpleJdbcTemplate and for single row I can build update sql that increments version column value and includes version in WHERE clause. Unfortunately te result int[] updated = simpleJdbcTemplate.batchUpdate does not contain rowcounts when using oracle driver. All elements are...

How to filter txt file by string with using batch

Hello guys I know this kind of problem will be very easy for you but I am total beginner in batch mode. The question is how bat file code should look like to generate a new txt file from specific one . for example . I have report txt Displaying status for license file: 7788@Server01 License Server: server01 Lice...

How do I do batch upserts in SQL Server?

I'm using the MERGE statement to upsert rows in an sql server 2008 database. However, my sproc is a single-row operation, whereas in fact I'd prefer to batch these. Is this even possible and, if so, how do I do it? ...

Read Text File line by line using Command Prompt/Batch

Hello All, First of all I am very thankful to the owner of this website. I have learned and implement various technologies with the help of solutions provided by the readers. I know the question I asked is posted many time in this forum. And I have tired all of the solutions available, but no luck I may case I am trying to read a dat f...

Moving and renaming files, keeping extension but include sub directories in batch file

Forgive me if this is nor the place to ask these questions, I am new to batch and scripts and a bit new to these kind of posts... I have a folder that will receive files and folders, I want to run a script that looks at the directory and renames all files in each subfolder numerically, and moves them if possible. For example I have s...

Calling Tortoise from command line and build if new code (how to know if tortoise updated anything)?

I am writing a batch file which is supposed to update the source files from tortoise and - if anything new was gotten - build the solution. Should be a very simple task. My batchfile looks like this (I've removed the non-essentials) set updatepath=%1 set solution=%2 set output=%3.txt call TortoiseProc.exe /command:update /path:%update...

Windows FTP batch sript to read & dl from external user list

i have several old, unused batches that i'm redoing.. I have a batch file for an old network arch from several years ago.. the main thing I'd like it to do now is read a list of files.. I'll explain the setup.. Server updates a complete list [CurrentMediaStores.txt] 2x a day. The laptops can set settings to DL this list through their st...

How to check java installation from batch script?

I need to write a batch script to find out if java is installed, and if it is, then under what path? I feel it has to be something similar to: for /f %%j in ("java.exe") do ( set JAVA_HOME=.......... ) but I can not quite nail it. P.S. Has to work with path with spaces two. Like if java is installed into "Program Files" Thanks...

xcopy directories and subdirectories recursively and filter only filenames by extension

Here is what i have for now: xcopy "c:\projects\SampleProject" "c:\temp\copytest" /E /H /EXCLUDE:elist.txt It does all the job i need except filtering filenames by extensions. For example: copy all *.exe files from c:\temp\copytest and subdirectories. How to do that? ...

Remove Trailing Slash From Batch File Input

I have a batch file that I want to improve. Instead of requiring a user to provide a folder path without a trailing slash, is there an easy way for me to just remove the last character from the path if there is a slash on the end? :START @echo What folder do you want to process? (Provide a path without a closing backslash) set /p datapa...

Batch file using WINRAR

i need help with batch file for WINRAR pleasee hi i am trying to use winrar to convert all my different folders individually from one location to another. example: c:\projects\test c:\projects\country c:\projects\db to c:\backup\test.rar c:\backup\country.rar c:\backup\db.rar I am trying the following cmd, which works bu...

Batch file assign returned values from a command into a variable (from powershell)

i am refering to this question ASSIGN win XP commandline output to variable i am trying to use it on a powershell code segment so i typed powershell date (get-date).AddDays(-1) -format yyyyMMdd and confirm it returns like 20100601 but then if i tried to for /f "tokens=*" %a in ('powershell date get-date -format yyyyMMdd ') do s...

windows batch: react to command not found

hello, i want to write a simple batch script, that calls a certain exe, but if this one is not found, it should call another exe. so in pseudocode set file=c:\path\tool.exe if(fileexists(file)) { call file } else { call c:\somethingelse.exe } thanks! ...

Problem parsing a list in batch

I am trying to extract tokens from a list of strings using a batch script, but for some reason it ignores my string if it contains an asterisk. An example to illustrate this problem is as follows: @echo off set mylist="test1a,test1b" set mylist="test2a,test2b*" %mylist% set mylist="test3a,test3b" %mylist% echo %mylist% for %%a in ( ...

How to get path from a variable

Following http://stackoverflow.com/questions/659647/how-to-get-folder-path-from-file-path-with-cmd I want to strip the path (without the filename) from a variable. following the logic of the methods discussed above I would like to use batch bellow, which doesn't work. any takers? possible? set cpp="C:\temp\lib.dll" echo %cpp% "C:\temp...

How to enable IIS server functions on windows from your C# Programm (or just using BAT file)?

How to enable IIS server functions on windows from your C# Programm (or just using BAT file)? ...

How do I Continue a batch file only if a process IS running

I have successfully managed to hold a batch file until a process ends. But how do I hold a batch file until a process starts? I am working using the following code: @echo off set process_1="calc.exe" set process_2="mmc.exe" set ignore_result=INFO: set no_ignore=mmc.exe :1 for /f "usebackq" %%M in (`tasklist /nh /fi "imagename eq %pro...

Batch file - get file name without extension from passed parameter

Hi, i am trying to create a DOS batch file to run: .tex --> .dvi : latex filename.tex .dvi --> .ps : dvips -o filename.ps filename .ps --> .pdf : ps2pdf filename.ps I tried: latex %1 dvips -o %~n%1.ps %n%1 ps2pdf %~n%1.ps assuming that ~n will give me the file name without the extension of a passed file. However, it doesn't wo...

batch files command line arguments

hi i am setting a string in a variable set main=svn commit -m "Build version number update" install\msbuild\VersionNumber.txt and passing "%main%" as a command line argument to another script template.bat . but in template.bat "Build version number update" is cosidered a 2nd arg and rest as 3rd one. please tell me how to pass the ...