batch-file

HOW to find last SUNDAY DATE through batch

大憨熊 提交于 2020-01-15 08:03:46
问题 How to find 'last SUNDAY DATE' through batch command? what I was trying is echo %date:~4,2%%date:~7,2%%date:~10,4% this is good for current date but for last Sunday date... can anyone suggest any logic through batch. 回答1: Windows PowerShell: [DateTime]::Now.AddDays(-1 * [DateTime]::Now.DayOfWeek.value__) Sorry the environment variable %date% in Batch (.bat) files sounds uneasy to do calculations. 来源: https://stackoverflow.com/questions/33773683/how-to-find-last-sunday-date-through-batch

HOW to find last SUNDAY DATE through batch

不问归期 提交于 2020-01-15 08:03:08
问题 How to find 'last SUNDAY DATE' through batch command? what I was trying is echo %date:~4,2%%date:~7,2%%date:~10,4% this is good for current date but for last Sunday date... can anyone suggest any logic through batch. 回答1: Windows PowerShell: [DateTime]::Now.AddDays(-1 * [DateTime]::Now.DayOfWeek.value__) Sorry the environment variable %date% in Batch (.bat) files sounds uneasy to do calculations. 来源: https://stackoverflow.com/questions/33773683/how-to-find-last-sunday-date-through-batch

Need to replace 13 blank spaces from 1 very long line of text file

混江龙づ霸主 提交于 2020-01-15 07:55:20
问题 I have a file (1.8 Mb) that has 1 single (very long) row of text. The values on that row are generally separated by 13 blank spaces. What I am trying to do is to replace these 13 blank spaces with a pipe | delimiter so that I can process this text file using SSIS. So far, I have had no success in programmatically processing this file using a batch file. I have tried using the below code that I got from another SO post. @echo off REM create empty file: break>R1.txt setlocal

Loop through folders in subdirectories and combine text files

二次信任 提交于 2020-01-15 07:54:45
问题 I am wanting to loop through folders within a subdirectory and combine all text files into one file. I found some answers online but none seems to work. Any help is much appreciated. I have provided what I've found below. In the example below the DummyFolder has multiple subdirectories that contain .txt files that need to be merged into 1 file. I got code 3 to work yesterday but somehow I changed something and it is no longer working for some reason. Code 1: @echo off set "header=C:\Users

Not recognized command everytime in the first line of a code

故事扮演 提交于 2020-01-15 07:24:50
问题 I have a problem with my BATCH file... Whatever is written on the first line, it says: [command] is not a command. Like so: @ECHO OFF I get this output: [C:\folder (path)]>´╗┐@ECHO OFF ´╗┐@ECHO is not a command It does the same even in a clear batch file(nothing except @ECHO OFF in it). Please help! 回答1: You are seeing the BOM (Byte Order Mark) of the file, probably utf-8 encoded. Open with an editor and save the file with ANSI encoding. 来源: https://stackoverflow.com/questions/28836113/not

Apache Spark: batch processing of files

懵懂的女人 提交于 2020-01-15 06:41:19
问题 I have directories, sub directories setup on HDFS and I'd like to pre process all the files before loading them all at once into memory. I basically have big files ( 1MB ) that once processed will be more like 1KB , and then do sc.wholeTextFiles to get started with my analysis How do I loop on each file ( *.xml ) on my directories/subdirectories, do an operation (let's say for the example's sake, keep the first line), and then dump the result back to HDFS (new file, say .xmlr ) ? 回答1: I'd

Run .bat file from C#

无人久伴 提交于 2020-01-15 06:08:43
问题 i am facing a strange issue , i have a .bat file which contains a code for renaming a file , when i open the .bat file manually it does what it is written on it which is renaming a file , but when i try to open it programtically from C# , it doesnt do anything , it jsut open the file and do not compile what it is written into . i typed that code : Process.Start(@"file.bat"); I also knew if you typed the path into cmd and pressed enter it will open the file and compile it , so i wrote that :

Run .bat file from C#

廉价感情. 提交于 2020-01-15 06:06:47
问题 i am facing a strange issue , i have a .bat file which contains a code for renaming a file , when i open the .bat file manually it does what it is written on it which is renaming a file , but when i try to open it programtically from C# , it doesnt do anything , it jsut open the file and do not compile what it is written into . i typed that code : Process.Start(@"file.bat"); I also knew if you typed the path into cmd and pressed enter it will open the file and compile it , so i wrote that :

SQL Statements in a Windows Batch File

…衆ロ難τιáo~ 提交于 2020-01-15 04:58:50
问题 Is there any way to have a Windows batch file directly input SQL statements without calling a script? I want the batch file to login to SQL and then enter in the statements directly. EDIT: I'm using Oracle v10g 回答1: For a single command you can use this trick: echo select * from dual; | sqlplus user/pw@db 回答2: To run something on SQL server 2005/2008, you could use sqlcmd command line utility. sqlcmd -h prints the list of switches. 回答3: Short answer: No. Batch files by themselves can't do

How to add a stop execution command in a batch file

两盒软妹~` 提交于 2020-01-15 03:52:25
问题 I have to create a batch file which will perform some operation but I need to add some commands so that it will stop execution if it exceeds 30 minutes of execution time. Can anybody help? I am new to batch scripting. 回答1: Rather you need to call your .bat from another one and check after 30 minutes if it's still running @echo off set "my_bat=E:\MyBat.bat" for /f "delims=" %%a in ('wmic process call create "%my_bat%" ^|find "ProcessId"') do ( for /f "tokens=2 delims=;= " %%# in ("%%a") do set