cmd

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

Create subdirectory under each directory containing a file

假如想象 提交于 2020-03-23 12:01:35
问题 I have a large number of photos that are contained in over 100 directories. These are all pre-installation photos. I would like to keep the existing directory structure but add a \pre and \post directory in any directory that contains a .jpg photo. I dont want a subdirectory created if a given directory only contains other directories but not files For testing , I have a single .jpg in c:\temp\one\two\three. I ran this command in c:\temp: FOR /R c:\temp %G IN (*.jpg) DO mkdir pre However, it

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

execute an exe on windows using groovy script

你。 提交于 2020-03-21 04:00:07
问题 I am trying to execute a MIR3 (notification system) exe from the Groovy console: def proc = "cmd /c C:\\Users\\AAithal\\Desktop\\MIR3\bin\\inConsole -H \"company.mir3.com\" -u \"user\" -p \"password\" -I -i \"Server\"".execute(); proc.waitForProcessOutput(System.out, System.err); println "proc" But get an error: The filename, directory name, or volume label syntax is incorrect. The path I have in the script is correct and I am able to execute the same from Windows CLI and getting the required

execute an exe on windows using groovy script

你离开我真会死。 提交于 2020-03-21 03:59:15
问题 I am trying to execute a MIR3 (notification system) exe from the Groovy console: def proc = "cmd /c C:\\Users\\AAithal\\Desktop\\MIR3\bin\\inConsole -H \"company.mir3.com\" -u \"user\" -p \"password\" -I -i \"Server\"".execute(); proc.waitForProcessOutput(System.out, System.err); println "proc" But get an error: The filename, directory name, or volume label syntax is incorrect. The path I have in the script is correct and I am able to execute the same from Windows CLI and getting the required

How to run a python program in Windows 10 command prompt

∥☆過路亽.° 提交于 2020-03-15 05:46:27
问题 I am getting as such error for executing my hello world program: "This file does not have a program associated with it for performing this action" 回答1: 1) Download the official version of Python 2) Use custom installation following the screenshots bellow. 3) Run your hello.py file directly from the command line by typing hello.py Screenshots #1 Screenshots #2 Screenshots #3 I have this python code that I'm running on just by typing Q60471933.py from datetime import datetime print("\nHello