batch-file

unable to run prometheus on windows 10 for Cassandra [duplicate]

我只是一个虾纸丫 提交于 2021-01-05 11:25:01
问题 This question already has an answer here : convert a .sh command into .bat equivalent (1 answer) Closed 17 days ago . I am following this tutorial to run Prometheus on Windows10 . The tutorial is for linux . I suppose the only command I need to change is for powershell . However, when I try to access the metrics, the application doesn't connect. https://www.robustperception.io/monitoring-cassandra-with-prometheus Instead of echo 'JVM_OPTS="$JVM_OPTS -javaagent:'$PWD/jmx_prometheus_javaagent-0

Why is “ECHO is off” displayed after output of data of interest on running WMIC in a FOR loop?

亡梦爱人 提交于 2021-01-05 06:50:36
问题 Here is the code: @echo off setlocal EnableDelayedExpansion for /f "tokens=* skip=1 delims=\" %%b in ('wmic /node:%CompName% COMPUTERSYSTEM GET USERNAME') do echo %%b Output: domain\username ECHO is off. Expected result: username Notes: The variable CompName will be set prior. This can be ignored. This code is a part of a larger code I am writing for this batch file where I'll just need to pull the username to have it set as a variable. Pseudo code: set TargetUsername = (results from above)

How to do a “dir > output.txt” on selected files only

元气小坏坏 提交于 2021-01-05 05:56:38
问题 Is it possible via batch file to take select multiple files in Explorer and write their names (and their names only; not every file in the folder) to a text file? Thanks. 回答1: Yes, this is possible. Use following batch code: @echo off set "OutputFile=%USERPROFILE%\Desktop\FileNames.txt" del "%OutputFile%" 2>nul :NextFileName if not "%~1" == "" ( echo %~1>>"%OutputFile%" shift goto NextFileName ) if exist "%OutputFile%" ( %SystemRoot%\System32\sort.exe "%OutputFile%" /O "%OutputFile%" ) The

How to do a “dir > output.txt” on selected files only

≡放荡痞女 提交于 2021-01-05 05:52:28
问题 Is it possible via batch file to take select multiple files in Explorer and write their names (and their names only; not every file in the folder) to a text file? Thanks. 回答1: Yes, this is possible. Use following batch code: @echo off set "OutputFile=%USERPROFILE%\Desktop\FileNames.txt" del "%OutputFile%" 2>nul :NextFileName if not "%~1" == "" ( echo %~1>>"%OutputFile%" shift goto NextFileName ) if exist "%OutputFile%" ( %SystemRoot%\System32\sort.exe "%OutputFile%" /O "%OutputFile%" ) The

How to do a “dir > output.txt” on selected files only

99封情书 提交于 2021-01-05 05:51:37
问题 Is it possible via batch file to take select multiple files in Explorer and write their names (and their names only; not every file in the folder) to a text file? Thanks. 回答1: Yes, this is possible. Use following batch code: @echo off set "OutputFile=%USERPROFILE%\Desktop\FileNames.txt" del "%OutputFile%" 2>nul :NextFileName if not "%~1" == "" ( echo %~1>>"%OutputFile%" shift goto NextFileName ) if exist "%OutputFile%" ( %SystemRoot%\System32\sort.exe "%OutputFile%" /O "%OutputFile%" ) The

Batch script not processing files with () in name?

混江龙づ霸主 提交于 2021-01-01 17:51:35
问题 I'm trying to rename all the files in a folder to a number, using this: setlocal enabledelayedexpansion set "count=1" for /f %%f in ('dir /b /o:-d /tc *.jpg') do ( ren %%f !count!.jpg set /a count+=1 ) pause However, it is only applying this code to the files that do not have () in them. So a file like: hello.jpg works, whereas: hello (0).jpg does not get picked up. And googling batch script syntax is an exercise in frustration for some reason, so I cannot for the life of me figure out why it

Batch file choice command more than 10 parameter

筅森魡賤 提交于 2021-01-01 13:54:04
问题 I have a batch script which founds which drive is carrying my folder (diskpart situation) and founding folder, then it lists the text files (for now its text) in that folder. Anyways the problem is while the batch is asking me to choose which one do i want to open, it works until 9. I can't even press 10 because when i press 1 it automatically opens the text file. How can i write 2 digit numbers? Because the folder always will change and the might be 30 choices. Here's my code; @for %%a in (

Batch file choice command more than 10 parameter

痴心易碎 提交于 2021-01-01 13:53:43
问题 I have a batch script which founds which drive is carrying my folder (diskpart situation) and founding folder, then it lists the text files (for now its text) in that folder. Anyways the problem is while the batch is asking me to choose which one do i want to open, it works until 9. I can't even press 10 because when i press 1 it automatically opens the text file. How can i write 2 digit numbers? Because the folder always will change and the might be 30 choices. Here's my code; @for %%a in (

How to safely echo FOR variable %%~p followed by a string literal

不问归期 提交于 2021-01-01 05:00:50
问题 I have a variable %%p created from for /f command When i try to use it with some additional references like: %%~dp and then write some text afterwards it accesses a different variable set var="%%~dpabc.txt" Code outputs %%~dpa instead of %%~dp 回答1: So you must be using FOR /F with multiple tokens, like for /f "tokens=1-16" %%a in (file) do echo %%~dpabc.txt Or your code could have nested FOR loops. Something like for %%a in (something) do ( for %%p in (somethingelse) do ( echo %%~dpabc.txt )

How do you match an exact file extension under Windows/command line/file open dialog?

ε祈祈猫儿з 提交于 2021-01-01 04:53:17
问题 I am trying to get a directory listing of only files with a given extension. At first blush this seems to be a simple thing to do, however check out this simple example: C:\CODE\metcal>dir /b *.exe metcal.exe metcal.exe1 Notice that this returns metcal.**exe** and metcal.**exe1** as matches. With python files a similar thing happens: C:\CODE\metcal>dir /b *.py metcal.py metcal.pyc Notice again Windows has determined that *.py takes anything that starts with *.py so it captures the .pyc files