batch-file

my batch script will not open/work properly

时光毁灭记忆、已成空白 提交于 2020-01-14 05:00:11
问题 I'm not sure why my batch script is not working I don't know too much but I get the basics. I've tried Googling other answers but it's difficult when your stuff is different. I feel it's the ASCII art thats wrong and is what's messing it up. @echo off title VHACK V2 prompt Client #306011 $G color 3 echo VHACK V2 echo "Reform whats formed" echo >=> >=> >=> >=> >> >=> >=> >=> echo >=> >=> >=> >=> >>=> >=> >=> >=> >=> echo >=> >=> >=> >=> >> >=> >=> >=> >=> echo >=> >=> >=====>>=> >=> >=> >=> >>

[BATCH / .Bat files]Help counting up error?

≡放荡痞女 提交于 2020-01-14 04:41:10
问题 well im trying to have a batch file to count up every 1 second but it comes that it partially can .. the code i did was if seconds are lower than 10 than they will be displayed like 01,02 .. not like 1,2 .. here is the full file @Echo off set m=00 set m1=00 //m1 being minutes and m being seconds echo %m% :clock set /a m+=1 if %m% LSS 10 ( if %m% GTR 0 ( set m=0%m%)) ELSE (break) // for detecting if less than 10 found out that break doesnt do any job if %m% GTR 60 (set /a m1+=1) //60 seconds

How to use findstr to search for multiple strings in one line

本秂侑毒 提交于 2020-01-14 03:35:09
问题 So I want to be able to search for the string "[ FAILED ]" and the string "." that are both on the same line inside of a text file. How would I do this? I tried this: FINDSTR /C:"[ FAILED ]" /C:"." output_.txt but it produces lines that contain either of the strings. If possible I also want to be able to exclude any lines that contain numbers from my finds. 回答1: I have answered my own question using piping and coming up with the following command: FINDSTR /C:"[ FAILED ]" output_.txt | FINDSTR

execute a vbs every 30 minutes

放肆的年华 提交于 2020-01-14 02:09:52
问题 I want outlook to email a server every 30 mins in real time. is there a way i can do it in this current code or via batch file? making a scheduled task is unavailable and no third party software set objOutlook = CreateObject( "Outlook.Application" ) set objMail = objOutlook.CreateItem(0) strMessage = "Test" ON ERROR RESUME NEXT With objMail .From = "email" .To = "email" .Subject = "Test" .Body = strMessage .Save end with objMail.OriginatorDeliveryReportRequested = True objMail.Display objMail

Batch File auto quits. I can't find the error

 ̄綄美尐妖づ 提交于 2020-01-13 20:46:30
问题 I have been coding a small thing that, rather stupidly, has been taking me a while. What it is meant to do is always have a certain excel spreadsheet (named Homework.xlsx) open between two certain times (4:30 and 5:30). The thing is it doesn't actually stay open to check for those times, even though I have it set to a loop that repeats every minute. Here is the code: SET "stime=16:30:00.00" SET "etime=17:30:00.00" :start TASKLIST /FI "IMAGENAME EQ EXCEL.EXE" 2>NUL | FIND /I /N "EXCEL.EXE"

Batch File auto quits. I can't find the error

风格不统一 提交于 2020-01-13 20:44:28
问题 I have been coding a small thing that, rather stupidly, has been taking me a while. What it is meant to do is always have a certain excel spreadsheet (named Homework.xlsx) open between two certain times (4:30 and 5:30). The thing is it doesn't actually stay open to check for those times, even though I have it set to a loop that repeats every minute. Here is the code: SET "stime=16:30:00.00" SET "etime=17:30:00.00" :start TASKLIST /FI "IMAGENAME EQ EXCEL.EXE" 2>NUL | FIND /I /N "EXCEL.EXE"

Batch to output a list of dates from given for /L parameter

Deadly 提交于 2020-01-13 20:38:06
问题 Please consider the following codes: @echo off setlocal enabledelayedexpansion FOR /L %%G IN (0,1,19) DO ( set /a "Dday=%_day%+%%G" if %mth% equ sml ( if !Dday! gtr 30 ( set "_day=1" set /a "_month+=1" ) if !_month! gtr 12 ( set "_month=1" set /a "_year+=1" ) ) else ( if %mth% equ big ( if !Dday! gtr 31 ( set "_day=1" set /a "_month+=1" ) if !_month! gtr 12 ( set "_month=1" set /a "_year+=1" ) ) ) echo !Dday!/!_month!/!_year!.txt ) Consider the following date: 20/04/2016 _day = 20 ; _month =

Make a Batch File That Keeps Both Files When a Name Conflict Occurs

纵然是瞬间 提交于 2020-01-13 20:30:25
问题 Is there any way to make a batch file that does not overwrite an existing file when there is a name conflict, but instead keeps both copies of the file in the same path? 回答1: The Batch file below works like COPY command with just one file. If the file already exist in target folder, a number in parentheses is added to new file in order to keep both files. @echo off Rem mycopy sourceFile targetDir Set targetName=%~1 Set i=0 :nextName If not exist "%~2/%targetName%" goto copy Set /A i+=1 Set

Save the result of a command in variable, Windows batch

こ雲淡風輕ζ 提交于 2020-01-13 19:20:03
问题 I am trying to write a batch script that saves the result of a command in a variable. so I can use it later. For example I am tryin to run this on the script: sc queryex "Service" |find /i "pid" but I want to save this result in a variable. set PIDRS=sc queryex "Themes" |find /i "pid" ECHO "%PIDRS% Any Ideas? 回答1: for /f "tokens=* delims=" %%# in ('sc queryex "Themes" ^|find /i "pid"') do set "PIDRS=%%#" echo %PIDRS% This will set the entire line to PIDRS here's how to get only the pid: @echo

Save the result of a command in variable, Windows batch

帅比萌擦擦* 提交于 2020-01-13 19:19:08
问题 I am trying to write a batch script that saves the result of a command in a variable. so I can use it later. For example I am tryin to run this on the script: sc queryex "Service" |find /i "pid" but I want to save this result in a variable. set PIDRS=sc queryex "Themes" |find /i "pid" ECHO "%PIDRS% Any Ideas? 回答1: for /f "tokens=* delims=" %%# in ('sc queryex "Themes" ^|find /i "pid"') do set "PIDRS=%%#" echo %PIDRS% This will set the entire line to PIDRS here's how to get only the pid: @echo