batch-file

Batch File Output Issue

£可爱£侵袭症+ 提交于 2020-08-10 19:24:00
问题 I have a batch file which, if I run manually, produces a text file with a single number. However, if I schedule it with Task Scheduler, it produces an "error". Let me know if there is anything obvious that I am doing wrong. Batch file: rem Call mysql_start. bat which starts mysql and runs get_rain.bat and sends output to raw_totals.txt call mysql_start.bat rem Open raw_totals and remove 'raincounter' header type C:\CumulusMX\cocorahs_reports\raw_totals.txt | findstr /v raincounter > C:

Batch File Output Issue

江枫思渺然 提交于 2020-08-10 19:23:04
问题 I have a batch file which, if I run manually, produces a text file with a single number. However, if I schedule it with Task Scheduler, it produces an "error". Let me know if there is anything obvious that I am doing wrong. Batch file: rem Call mysql_start. bat which starts mysql and runs get_rain.bat and sends output to raw_totals.txt call mysql_start.bat rem Open raw_totals and remove 'raincounter' header type C:\CumulusMX\cocorahs_reports\raw_totals.txt | findstr /v raincounter > C:

Start a Windows service from a batch script and take appropriate action based on result

送分小仙女□ 提交于 2020-08-10 13:56:26
问题 I have a .bat script that attempts to start a Windows service at the end. :start_wildfly echo. set /p wildfly_service_name="Enter Wildfly service name: " echo INFO: Starting %wildfly_service_name%... echo. call net start "%wildfly_service_name%" I want to be able to interpret the result of the net start attempt so that I can have my script take the appropriate action if it fails (e.g. if the service is already running, restart it. If the service name is invalid, re-prompt for the name again,

Start a Windows service from a batch script and take appropriate action based on result

两盒软妹~` 提交于 2020-08-10 13:56:23
问题 I have a .bat script that attempts to start a Windows service at the end. :start_wildfly echo. set /p wildfly_service_name="Enter Wildfly service name: " echo INFO: Starting %wildfly_service_name%... echo. call net start "%wildfly_service_name%" I want to be able to interpret the result of the net start attempt so that I can have my script take the appropriate action if it fails (e.g. if the service is already running, restart it. If the service name is invalid, re-prompt for the name again,

Batch file if string starts by

萝らか妹 提交于 2020-08-08 03:36:41
问题 I need to know if a string starts by something, produced this little example to explain (I'm using a Batch compiler/Pre-processor or whatever with advanced commands) : rem GetInput if "%result%"=="cd *" goto Cd :Cd if "%result%"=="cd meow" Echo Going to directory 'meow'... But this code doesn't work, at the line with a "cd *" the script dont go to :Cd if the string %result% starts with the letters cd. Thank you 回答1: If I understand this correctly, you're trying to determine whether that value

How to find Microsoft Office path from command line

穿精又带淫゛_ 提交于 2020-08-07 06:32:47
问题 I would like to use command line to locate the path of MS office. It should return something like C:\Program Files (x86)\Microsoft Office\Office14 which might differ to different users. Tried using: where WINWORD.EXE INFO: Could not find files for the given pattern(s). for %i in (WINWORD.EXE) do @echo. %~$PATH:i No output Thanks for any help 回答1: One starting point is the registry entries for application registration reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WINWORD

How to find Microsoft Office path from command line

℡╲_俬逩灬. 提交于 2020-08-07 06:32:27
问题 I would like to use command line to locate the path of MS office. It should return something like C:\Program Files (x86)\Microsoft Office\Office14 which might differ to different users. Tried using: where WINWORD.EXE INFO: Could not find files for the given pattern(s). for %i in (WINWORD.EXE) do @echo. %~$PATH:i No output Thanks for any help 回答1: One starting point is the registry entries for application registration reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WINWORD

Batch file to add git branch into header file

前提是你 提交于 2020-08-06 05:20:11
问题 I'm working on a C project, under git, and I would like to add the branch name into an header file. This is my idea: I have a version header file: /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef _VERSION_INTERFACE_H_ #define _VERSION_INTERFACE_H_ /* Includes ------------------------------------------------------------------*/ /* Exported defines ----------------------------------------------------------*/ /* Exported types -----------------------------

Batch file multitasking issues sharing variables with parent

五迷三道 提交于 2020-08-06 04:01:18
问题 I'm trying to mass encode video files in x265 and wanted to come up with a batch file that could automate the process. In order to expedite things, I found that having 3 instances of ffmpeg called with 2 threads resulted in ideal encoding times, however I've tried all day yesterday to come up with a way to get a batch file that will call 3 instances and then call new ones when they complete. So far, this is where I am: PARENT BATCH @echo off Setlocal EnableDelayedExpansion SET /A COUNT=0 for

Batch .txt reader

别来无恙 提交于 2020-08-05 06:14:08
问题 So, basically I want a Batch file to read a .txt. The problem is that the Batch file needs to update everytime a new line gets written to the .txt @echo off set "pc=%1" FOR /F "delims=:" %%A IN ('findstr /N .* "%pc%"') DO set "zeilen=%%A" type %pc% set /A zeilen1=%zeilen% :loop if not %zeilen% == %zeilen1% ( set "line=" set zeilen2=%zeilen% - 1 for /f %%a in ('more/e +%zeilen2% ^< %pc%') do ( if not defined line set "line=%%a" ) echo %line% set /A zeilen+=1 ) FOR /F "delims=:" %%A IN (