batch-file

Need to copy the lines just before a particular string using batch file

↘锁芯ラ 提交于 2020-01-06 07:24:29
问题 I have a file like this: Executing resource: D:\waste2\SPC\depks_rtl_teller_custom.spc Executing resource: D:\waste2\SPC\ifpks_msg_incoming_cluster.spc Failed to execute: Executing resource: D:\waste2\SQL\casapks_batch.sql Failed to execute: Executing resource: D:\waste2\SQL\depks_decbatop_kernel.sql Executing resource: D:\waste2\SQL\depks_services.sql Failed to execute: I need a batch file or perl script or ANT script to pick all the lines just in front of the string "Failed to execute:" and

Loop that appends filename when copying same filename from different folders to a new folder

此生再无相见时 提交于 2020-01-06 07:24:11
问题 I have the following code to search for a specific file name (ratings.zil) across multiple folders and copy them to a new folder: for /R %f in (ratings.zil) do @IF EXIST %f copy "%f" "C:\here" But when the file copies to the new folder it overwrites instead of appending a number at the end of each ratings.zil – i.e. ratings(1).zil , ratings(2).zil . Is there a way to add a loop to the above code that will append a number after each file? This question was originally marked as a duplicate,

How to create batch file that move files from sub-folder up one level renaming duplicates?

百般思念 提交于 2020-01-06 07:19:22
问题 I already have a batch file that I can drop in any SHOW_NAME directory and it will move files from a sub-folder to its SEASON parent directory. For example: F:\TV_SHOWS\SHOW_NAME\SEASON1\TITLE_EP1\title_episode1.mkv F:\TV_SHOWS\SHOW_NAME\SEASON1\TITLE_EP2\title_episode2.mkv F:\TV_SHOWS\SHOW_NAME\SEASON1\TITLE_EP3\title_episode3.mkv F:\TV_SHOWS\SHOW_NAME\SEASON1\title_episode3.mkv When it moves all files to the parent folder ( SEASON1 ) the " title_episode3.mkv " is a duplicate and overwrites

Windows batches in Cygwin with spaces in path and arguments

拥有回忆 提交于 2020-01-06 07:16:25
问题 Consider this dummy Windows batch script: echo %1 Supposed just to echo to the terminal its first argument. Assume its path in resp. Windows, Cygwin style is: c:\test\win.bat /cygdrive/c/test/win.bat From Cygwin bash: $ c:\test\win.bat "hello world" "hello world" So quotes correctly identify a single argument. But now let us introduce spaces in path: "c:\te st\win.bat" /cygdrive/c/te\ st/win.bat Then: $ /cygdrive/c/te\ st/win.bat "hello world" Gives: "C:\te" is not recognized as an internal

User input multple values assigned to 1 variable BATCH

只谈情不闲聊 提交于 2020-01-06 07:07:16
问题 MY BATCH FILE LOOKS LIKE THIS ECHO OFF SET /P colu= Enter column name: SET /P sn= Enter ID (Press enter when finished): if %sn%={ENTER} GOTO START :START sqlcmd -U USER -P PWORD -S SERVER -d DBNAME-i sqlSCRIPT.sql -o LOG.txt -v delete=colu d_id=sn I want the user to be able to enter multiple ids in a single line. Those ID's will be deleted from the DB using the sqlScript.sql however this code is not allowing me to enter multple ids. It is looking at the values I enter as 1 whole value. For an

VB script for send mail

本小妞迷上赌 提交于 2020-01-06 07:07:16
问题 I dont have knowledge about vb scripting. so m asking here please help me... :) we have one backup batch script which copy all data to another server using robo copy. we schedule that script, but all the time we have to go that server and check manually that script run or not. now we have write one vb script that will call that batch script and check that script run properly if script run properly then mail will come as backup completed else backup is not completed. please if you have any

Parsing WMIC output

荒凉一梦 提交于 2020-01-06 07:05:40
问题 I have a BAT script that is supposed to read the current screen resolution to variables. I get the screen resolution with the wmic desktopmonitor get screenwidth /value command (for the width, the height is the same thing). Example output: C:\Users\Pietu1998>wmic desktopmonitor get screenwidth /value ScreenWidth=1920 ScreenWidth= C:\Users\Pietu1998> I have two monitors, so it only shows the resolution for the one in use. I have tried using a for loop to skip the first two empty lines and then

Looking for MORE/MOVE solutions that can handle files with more than 65534 rows

时光总嘲笑我的痴心妄想 提交于 2020-01-06 06:57:23
问题 I have numerous uniquely named .CSV files that I need to remove the first 17 lines from. Some of these files exceed 65534 rows so my MORE/MOVE Batch script is not working. Looking for alternative solutions. @echo off for %%a in (*.csv) do ( more +17 "%%a" >"%%a.new" move /y "%%a.new" "%%a" >nul ) Regardless of number of rows input I am looking to have the 17 header rows removed and new file with all remaining rows built. 回答1: Here's a powershell option; this one uses a stream to cater for

search given set of files and copy to another directory

*爱你&永不变心* 提交于 2020-01-06 06:48:46
问题 There is a given set of file names in a needToFind.txt file such as: myImage1.jpg , theImage.jpg, parisImage.jpg (This is a flie that I will format it does not matter filee names are seperated with comma, or line break) And there is a folder named /MyImageFolder, which contains lets say 1000 images, and also contains myImage1.jpg , theImage.jpg, parisImage.jpg I want to find those given images and copy them to another directory. I want to search given file names in needToFind.txt, in a

search given set of files and copy to another directory

安稳与你 提交于 2020-01-06 06:46:22
问题 There is a given set of file names in a needToFind.txt file such as: myImage1.jpg , theImage.jpg, parisImage.jpg (This is a flie that I will format it does not matter filee names are seperated with comma, or line break) And there is a folder named /MyImageFolder, which contains lets say 1000 images, and also contains myImage1.jpg , theImage.jpg, parisImage.jpg I want to find those given images and copy them to another directory. I want to search given file names in needToFind.txt, in a