batch-file

How do I verify if a file exists and it's from today?

安稳与你 提交于 2020-03-26 17:36:36
问题 I have this BATCH file, How to make sure the source file C:\file.zip exist and it's today's file, before applying the copy submission? following is not working when I tried: echo off cls echo will do a back if [ C:\file.zip ] then echo found, will validate if its the file created today? copy C:\file.zip "\\to_computer_of_enterprise\\granted\\to\\upload\\here" else: echo sorry do not exist fi 回答1: Here is a batch code not using command forfiles which is by default not available on Windows XP

Cannot install sdkmanager in windows 10

一个人想着一个人 提交于 2020-03-25 21:55:06
问题 I am trying to install the sdk manager alone for using it with Eclipse. I downloaded the zip file provided by google - commandlinetools-win-6200805_latest.zip from https://developer.android.com/studio But as I try to run the sdkmanager.bat file it doesn't run and i am getting the following errors: Error: could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli Please note that Java jdk path is set properly and there is no error with respect to that. If you are

Cannot install sdkmanager in windows 10

十年热恋 提交于 2020-03-25 21:54:11
问题 I am trying to install the sdk manager alone for using it with Eclipse. I downloaded the zip file provided by google - commandlinetools-win-6200805_latest.zip from https://developer.android.com/studio But as I try to run the sdkmanager.bat file it doesn't run and i am getting the following errors: Error: could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli Please note that Java jdk path is set properly and there is no error with respect to that. If you are

batch variable exclamation points used in dir | findstr

不想你离开。 提交于 2020-03-25 10:17:09
问题 I'm trying to find files that do not match (at the beginning of the filename) predefined formats contained in a .txt file. I have the following: @Echo off chcp 1254>nul setlocal DisableDelayedExpansion for /f "usebackq tokens=1,2,3* delims=~" %%f in ("%USERPROFILE%\Desktop\xref.txt") do ( set "DIRNAME=%%f" set "DIRNAM2=^%%f" set "PATHNAM=%%h" set "ALBUMNM=%%g" SETLOCAL EnableDelayedExpansion IF EXIST !PATHNAM!!DIRNAME! ( PushD !PATHNAM!!DIRNAME! dir /b /a-d "*" | findstr /v /r /c:"!DIRNAM2! -

Increment version number in file [closed]

佐手、 提交于 2020-03-23 07:47:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 10 days ago . I need to bump a version number in a file. The file looks like this: nuget { nuspec{ id = XXX; version: 0.0.30; title: XXX; what is the easiest way to bump that version number in batch or powershell? i also have to checkout and checkin the file in tfs, but i think i'm able to do this. For my understanding,

Reg add for loop

Deadly 提交于 2020-03-22 23:08:18
问题 Sorry if this question has been asked before, but I haven't been able to find an answer I can understand and apply. I'm writing a batch file that installs an application, and I need the batch file to add a registry key in the software key to every profile in the HKEY_USERS hive. I've been able to use REG ADD to add the key to the currently logged on user, but because our help desk would be running this batch file from an elevated command prompt, that change would not affect the user who

How to conditionally exit .BAT file from SQL code run through SQLCMD

五迷三道 提交于 2020-03-22 14:28:53
问题 I have a .bat (Windows command) file that includes invocations of SQLCMD and other commands. (Of course SQLCMD is sending my T-SQL code to SQL Server.) I want to detect certain conditions in the SQL code, and conditionally exit the entire batch file. I've tried various combinations of RAISERROR, THROW, and deliberate division by 0 (I'm not proud) along with various command line switches on SQLCMD and handling of errorlevel in the .bat file. I tried the answer to 5789568 but could not get it

How to conditionally exit .BAT file from SQL code run through SQLCMD

徘徊边缘 提交于 2020-03-22 14:19:06
问题 I have a .bat (Windows command) file that includes invocations of SQLCMD and other commands. (Of course SQLCMD is sending my T-SQL code to SQL Server.) I want to detect certain conditions in the SQL code, and conditionally exit the entire batch file. I've tried various combinations of RAISERROR, THROW, and deliberate division by 0 (I'm not proud) along with various command line switches on SQLCMD and handling of errorlevel in the .bat file. I tried the answer to 5789568 but could not get it

How to conditionally exit .BAT file from SQL code run through SQLCMD

放肆的年华 提交于 2020-03-22 14:17:51
问题 I have a .bat (Windows command) file that includes invocations of SQLCMD and other commands. (Of course SQLCMD is sending my T-SQL code to SQL Server.) I want to detect certain conditions in the SQL code, and conditionally exit the entire batch file. I've tried various combinations of RAISERROR, THROW, and deliberate division by 0 (I'm not proud) along with various command line switches on SQLCMD and handling of errorlevel in the .bat file. I tried the answer to 5789568 but could not get it

How to conditionally exit .BAT file from SQL code run through SQLCMD

大城市里の小女人 提交于 2020-03-22 14:17:19
问题 I have a .bat (Windows command) file that includes invocations of SQLCMD and other commands. (Of course SQLCMD is sending my T-SQL code to SQL Server.) I want to detect certain conditions in the SQL code, and conditionally exit the entire batch file. I've tried various combinations of RAISERROR, THROW, and deliberate division by 0 (I'm not proud) along with various command line switches on SQLCMD and handling of errorlevel in the .bat file. I tried the answer to 5789568 but could not get it