batch-file

How can I wrap a call to an .exe (with arguments) with another .exe?

…衆ロ難τιáo~ 提交于 2020-01-15 21:29:17
问题 I have a Windows executable (say program.exe ) and I want to provide users with 2 launchers that will pass different arguments to it. program.exe -a program.exe -b I can easily do this with 2 batch files, but I would rather provide users with 2 .exe files as they are more likely to be used correctly without editing. Is there an easy way to create such an executable? 回答1: Why create new executables? Why not just create desktop shortcuts to launch the single exe. 回答2: You might try this: http:/

How do I read individual PowerCfg settings?

耗尽温柔 提交于 2020-01-15 12:15:07
问题 If I run this command: powercfg -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c ...I can subsequently run this command: powercfg -GETACTIVESCHEME ...and it will tell me what I did. (It will output 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c.) Similarly, if I run this command: powercfg -change -monitor-timeout-dc 0 I want to know how I can query that. Is there some powercfg flag where I can read the current value of monitor-timeout-dc , and other settings like that? 回答1: This returns the monitor

how to run a batch file from java?

我怕爱的太早我们不能终老 提交于 2020-01-15 11:43:13
问题 I am trying run a batch file from my java codes, but unfortunately I could not run it properly. Actually the batch file is running but only the first line of the batch file is running, so please give solution to it, here are the codes and the batch file. class bata { public static void main(String [] args) { try { Runtime.getRuntime().exec("start_james.bat"); } catch(Exception e) {} } } and the batch file is cd\ c: cd C:\Tomcat 5.5\webapps\mail_testing\james-2.3.2\bin run.bat start 回答1: What

Get Previous and day before Previous date in batch file(cmd)

China☆狼群 提交于 2020-01-15 11:34:17
问题 I have the following to determine the date and grab a file based on date. I need to modify this grab a file that has a date of yesterday and day before yesterday, i.e. date-1 and date-2. What do I need to change? Thanks! echo @echo off > uploadsp.txt set mydate=%date:~10,4%%date:~4,2%%date:~7,2% echo set mydate=%date:~10,4%%date:~4,2%%date:~7,2% >> uploadsp.txt set myfile=Epic_DSH360144_Drug_Utilization_%mydate%_DU.txt echo put %myfile% >> uploadsp.txt exit 回答1: You can also call out to

Programmatically update a folder in PATH from a batch file

≯℡__Kan透↙ 提交于 2020-01-15 10:55:10
问题 (I do not think there is an exact similar match for this question) I need to make a batch file for Windows (XP and 7) that will: install Python check for any instance of a previous python folder in PATH (typically C:/Python2x, C:/Python3x,C:/Python2x/Scripts, C:/Python3x/Scripts) remove all these folders from PATHs permanently add C:/Python/Scripts and C:/Python permanently in PATH in System/Environment variables Is this something fairly doable using batch scripts ? I have read in a previous

Batch file to copy file from specific sub folder inside a folder to destination folder

我的梦境 提交于 2020-01-15 10:15:19
问题 I have a folder structure like his folder1-------| |123456------123.txt abc.txt |234567------fgt.txt 234.txt |abc---------ytr.txt 1234.txt I need to copy files from Main folders sub directories if the sub folder has a length of 6(only numbers) . So .txt files from 123456,234567 will be copied and abc will not be copied. I have tried using wildcards but not succeed yet. Thanks in advance. >xcopy /s "C:\Users\xxx.xxx\Desktop\folder1\*\*.txt" "C:\Users\xxx.xxx\Documents\New folder" /l /D:09-09

Why can't I run 2 commands consecutively using batch file for gcloud

百般思念 提交于 2020-01-15 10:15:17
问题 so I have this .bat file: @echo off cd C:\Users\user\Downloads gcloud auth activate-service-account --key-file=keyFileName.json gcloud auth print-access-token pause During the first gcloud command, it will suddenly crash the command prompt halfway, but when I copy and paste each line manually into command prompt in the same location as the location I am trying to cd to in the .bat file, it works... Any idea why? I am on Windows 10 by the way. Searching on Google, I found two related issues,

for statement > tokens issue

强颜欢笑 提交于 2020-01-15 10:13:46
问题 I want to create a command in my own command prompt that runs a command. So I set a sample variable. Here it is: set m=sample -gtc new -args sample So I tried using for in order to get the command after -gtc and after -args . So this is my for command: for /f "tokens=3,5" %%e in ("%m%") do echo %%e The command responded. But it only responded like tokens=3 meaning the command only echo-ed the one after -gtc not including the -args . I followed the way https://ss64.com/nt/for_cmd.html said.

Close cmd window after Git command in batch script

社会主义新天地 提交于 2020-01-15 09:15:12
问题 I wrote a short batch script (Windows 7) to bundle a Git repo and save a copy on a network drive: @ECHO OFF cd /D E:/mypath/myrepo.git start "Window title" "C:\pathto\Git\git-cmd.exe" git bundle create X:/outpath/name.bundle --branches --tags This works as expected, however, I would like the window to close when complete. I tried exit but the window just returns to the directory specified by cd , and remains open. How can I close the window? (I've seen plenty of speculative answers in other

Batch: delete line feed from end of text file using filepaths

筅森魡賤 提交于 2020-01-15 08:51:53
问题 This question is related to this question: Batch: delete line feed from end of text file? So I have a txt-file containing some information and I want to remove the last rows LFCR (line feed, carriage return) chars. I need to point out the source file path and the destination file path using variables and the filename as a parameter (%1). The batch code @echo off set @srcfile="D:\AgrCC\AgrTest\Report Results\%1" set @dstfile="D:\AgrCC\AgrTest\Data Export\%1" setlocal DisableDelayedExpansion