QuestionId stringlengths 3 8 | QuestionTitle stringlengths 15 149 | QuestionScore int64 1 27.2k | QuestionCreatedUtc stringdate 2008-08-01 18:33:08 2025-06-16 04:59:48 | QuestionBodyHtml stringlengths 40 28.2k | QuestionViewCount int64 78 16.5M | QuestionOwnerUserId float64 4 25.2M ⌀ | QuestionLastActivityUtc stringdate 2008-09-08 19:26:01 2026-01-24 22:40:25 | AcceptedAnswerId int64 266 79.7M | AnswerScore int64 2 30.1k | AnswerCreatedUtc stringdate 2008-08-01 23:40:28 2025-06-16 05:23:39 | AnswerOwnerUserId float64 1 29.5M ⌀ | AnswerLastActivityUtc stringdate 2008-08-01 23:40:28 2026-01-23 17:46:09 | QuestionLink stringlengths 31 36 | AnswerLink stringlengths 31 36 | AnswerBodyHtml stringlengths 35 33k | AnswerBodyPreview stringlengths 35 400 | AllTagIdsCsv stringlengths 2 37 | AllTagNamesCsv stringlengths 2 106 | MergedQuestion stringlengths 74 28.4k | quality_filter stringclasses 10
values | unique_id int64 0 29k | tag_major_lang stringclasses 10
values | MergedQuestion_md stringlengths 60 28.1k | AnswerBodyHtml_md stringlengths 14 29.2k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11685375 | I need to match or replace an asterisk * in a batch environmental variable using only native Windows commands. Is this possible? | 7 | 2012-07-27 09:49:52 | <p>I'm trying to remove an asterisk from an environmental variable string, but can't seem to do it.</p>
<p>I'm creating an m3u file based around search strings, so for instance I if I want to make an m3u file containing every song with the word love in it, I would enter:</p>
<pre><code>m3u *Love*
</code></pre>
<p>An... | 11,590 | 1,530,402 | 2019-11-28 20:05:41 | 11,685,376 | 12 | 2012-07-27 09:49:52 | 1,530,402 | 2019-05-21 11:26:47 | https://stackoverflow.com/q/11685375 | https://stackoverflow.com/a/11685376 | <p>The easy answer is no.</p>
<p>The problem that you're encountering stems from the fact that the asterisk * is a special character when used with the SET search and replace method. It matches multiple characters in a limited, but still useful, way. You can learn about that <a href="https://stackoverflow.com/question... | <p>The easy answer is no.</p> <p>The problem that you're encountering stems from the fact that the asterisk * is a special character when used with the SET search and replace method. It matches multiple characters in a limited, but still useful, way. You can learn about that <a href="https://stackoverflow.com/question... | 64, 2498, 2631, 7002 | batch-file, cmd, replace, windows | <h1>I need to match or replace an asterisk * in a batch environmental variable using only native Windows commands. Is this possible?</h1>
<p>I'm trying to remove an asterisk from an environmental variable string, but can't seem to do it.</p>
<p>I'm creating an m3u file based around search strings, so for instance I if... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,524 | cmd | # I need to match or replace an asterisk * in a batch environmental variable using only native Windows commands. Is this possible?
I'm trying to remove an asterisk from an environmental variable string, but can't seem to do it.
I'm creating an m3u file based around search strings, so for instance I if I want to make ... | The easy answer is no.
The problem that you're encountering stems from the fact that the asterisk * is a special character when used with the SET search and replace method. It matches multiple characters in a limited, but still useful, way. You can learn about that [here](https://stackoverflow.com/questions/11684073/i... |
11105743 | why is jvm throwing "unrecognized option" when i use "-d64"? | 7 | 2012-06-19 16:58:02 | <p>I'm setting up my JAVA_OPTS with: "-d64 -server -XX:+CMSClassUnloadingEnabled" and then some.</p>
<p>I thought the -d64 was to specify that the machine was 64bit or running on 64bit!?</p>
<p>This seems to work fine on Macs. When I tried it on Windows 7 using Cygwin to run the shell script, it breaks. If I remove t... | 7,713 | 802,281 | 2012-06-19 17:19:43 | 11,106,081 | 12 | 2012-06-19 17:19:43 | 20,322 | 2012-06-19 17:19:43 | https://stackoverflow.com/q/11105743 | https://stackoverflow.com/a/11106081 | <p>The <code>-d64</code> option is Solaris/Linux specific. On Windows that option is <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html" rel="noreferrer">not available</a></p>
<p>As Mac OsX is linux-based, the option would work there. On Windows you will need to select the JVM by selecti... | <p>The <code>-d64</code> option is Solaris/Linux specific. On Windows that option is <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html" rel="noreferrer">not available</a></p> <p>As Mac OsX is linux-based, the option would work there. On Windows you will need to select the JVM by selecti... | 1731, 2149, 7002 | batch-file, cygwin, jvm | <h1>why is jvm throwing "unrecognized option" when i use "-d64"?</h1>
<p>I'm setting up my JAVA_OPTS with: "-d64 -server -XX:+CMSClassUnloadingEnabled" and then some.</p>
<p>I thought the -d64 was to specify that the machine was 64bit or running on 64bit!?</p>
<p>This seems to work fine on Macs. When I tried it on Wi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,525 | cmd | # why is jvm throwing "unrecognized option" when i use "-d64"?
I'm setting up my JAVA_OPTS with: "-d64 -server -XX:+CMSClassUnloadingEnabled" and then some.
I thought the -d64 was to specify that the machine was 64bit or running on 64bit!?
This seems to work fine on Macs. When I tried it on Windows 7 using Cygwin to... | The `-d64` option is Solaris/Linux specific. On Windows that option is [not available](http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html)
As Mac OsX is linux-based, the option would work there. On Windows you will need to select the JVM by selecting the executable (the 64 bit/32 bit versions are s... |
10635840 | How to Delete all contents of a "File with no extension" using windows batch Command | 7 | 2012-05-17 12:34:14 | <p>I want to delete the contents of a file which has "FIlE" as extension i.e with no extension.
I know how to delete the contents of a Text file, but not about the file which has "File" as extension.</p>
<p>I would appreciate your efforts.
Thanks in advance.</p>
| 17,942 | 934,410 | 2019-10-01 19:08:11 | 10,635,963 | 12 | 2012-05-17 12:43:33 | 1,347,008 | 2012-05-17 12:54:03 | https://stackoverflow.com/q/10635840 | https://stackoverflow.com/a/10635963 | <p>Use <code>Del *.</code> in batch file to remove files with no extension.</p>
<p>use <code>Dir /A-D *.</code> to list down all files with no extension.</p>
<p>Use following command to clear the contents of a file</p>
<pre><code>findstr "Any data that is not available in origfilename" origfilename > origfilename... | <p>Use <code>Del *.</code> in batch file to remove files with no extension.</p> <p>use <code>Dir /A-D *.</code> to list down all files with no extension.</p> <p>Use following command to clear the contents of a file</p> <pre><code>findstr "Any data that is not available in origfilename" origfilename > origfilename... | 64, 7002 | batch-file, windows | <h1>How to Delete all contents of a "File with no extension" using windows batch Command</h1>
<p>I want to delete the contents of a file which has "FIlE" as extension i.e with no extension.
I know how to delete the contents of a Text file, but not about the file which has "File" as extension.</p>
<p>I would apprecia... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,526 | cmd | # How to Delete all contents of a "File with no extension" using windows batch Command
I want to delete the contents of a file which has "FIlE" as extension i.e with no extension.
I know how to delete the contents of a Text file, but not about the file which has "File" as extension.
I would appreciate your efforts.
T... | Use `Del *.` in batch file to remove files with no extension.
use `Dir /A-D *.` to list down all files with no extension.
Use following command to clear the contents of a file
```
findstr "Any data that is not available in origfilename" origfilename > origfilename
``` |
3896318 | Get access to all spring beans of a given type | 7 | 2010-10-09 16:05:21 | <p>I have a Spring application (Spring Batch not web application). In a test class, I want to grab access to all of my beans of a given type. <br><br>
I understand that in Spring you should generally use IOC and let the container inject your beans. However in this case, I want to loop through a variable number of bean... | 15,617 | 330,184 | 2010-10-11 09:05:04 | 3,897,016 | 12 | 2010-10-09 17:02:28 | 21,234 | 2010-10-09 17:02:28 | https://stackoverflow.com/q/3896318 | https://stackoverflow.com/a/3897016 | <p>You can get around the first problem by using <code>ApplicationContextAware</code> instead of <code>BeanFactoryAware</code>. This will pass in the <code>ApplicationContext</code>, which has the <code>getBeansOfType()</code> method which lets you retrieve all beans that are of a given type.</p>
<p>The second problem... | <p>You can get around the first problem by using <code>ApplicationContextAware</code> instead of <code>BeanFactoryAware</code>. This will pass in the <code>ApplicationContext</code>, which has the <code>getBeansOfType()</code> method which lets you retrieve all beans that are of a given type.</p> <p>The second problem... | 17, 760, 1211, 13425, 41895 | java, javabeans, proxy, spring, spring-batch | <h1>Get access to all spring beans of a given type</h1>
<p>I have a Spring application (Spring Batch not web application). In a test class, I want to grab access to all of my beans of a given type. <br><br>
I understand that in Spring you should generally use IOC and let the container inject your beans. However in thi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,529 | cmd | # Get access to all spring beans of a given type
I have a Spring application (Spring Batch not web application). In a test class, I want to grab access to all of my beans of a given type.
I understand that in Spring you should generally use IOC and let the container inject your beans. However in this case, I wan... | You can get around the first problem by using `ApplicationContextAware` instead of `BeanFactoryAware`. This will pass in the `ApplicationContext`, which has the `getBeansOfType()` method which lets you retrieve all beans that are of a given type.
The second problem is likely caused because something is creating AOP pr... |
3629831 | Copy a file to all folders batch file? | 7 | 2010-09-02 18:01:02 | <p>I need copy <code>credits.jpg</code> from <code>C:\Users\meotimdihia\Desktop\credits.jpg</code> to <code>D:\Software\destinationfolder and all subfolders</code>
I read many and i write </p>
<pre><code>/R "D:\Software\destinationfolder" %%I IN (.) DO COPY "C:\Users\meotimdihia\Desktop\credits.jpg" "%%I\credits.jpg"... | 21,976 | 329,424 | 2019-07-15 22:08:25 | 3,630,005 | 12 | 2010-09-02 18:23:55 | 418,983 | 2010-09-02 18:23:55 | https://stackoverflow.com/q/3629831 | https://stackoverflow.com/a/3630005 | <p>Give this a try:</p>
<pre><code>for /r "D:\Software\destinationfolder" %i in (.) do @copy "C:\Users\meotimdihia\Desktop\credits.jpg" "%i"
</code></pre>
<p>Of course, if it's to go into a batch file, double the '%'.</p>
| <p>Give this a try:</p> <pre><code>for /r "D:\Software\destinationfolder" %i in (.) do @copy "C:\Users\meotimdihia\Desktop\credits.jpg" "%i" </code></pre> <p>Of course, if it's to go into a batch file, double the '%'.</p> | 64, 7002, 34595 | batch-file, windows, windows-7 | <h1>Copy a file to all folders batch file?</h1>
<p>I need copy <code>credits.jpg</code> from <code>C:\Users\meotimdihia\Desktop\credits.jpg</code> to <code>D:\Software\destinationfolder and all subfolders</code>
I read many and i write </p>
<pre><code>/R "D:\Software\destinationfolder" %%I IN (.) DO COPY "C:\Users\me... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,530 | cmd | # Copy a file to all folders batch file?
I need copy `credits.jpg` from `C:\Users\meotimdihia\Desktop\credits.jpg` to `D:\Software\destinationfolder and all subfolders`
I read many and i write
```
/R "D:\Software\destinationfolder" %%I IN (.) DO COPY "C:\Users\meotimdihia\Desktop\credits.jpg" "%%I\credits.jpg"
```
t... | Give this a try:
```
for /r "D:\Software\destinationfolder" %i in (.) do @copy "C:\Users\meotimdihia\Desktop\credits.jpg" "%i"
```
Of course, if it's to go into a batch file, double the '%'. |
2556778 | Writing a batch file to delete files with wildcards | 7 | 2010-03-31 22:00:50 | <p>I have multiple websites set up in the same folder, and I want to create a batch file that will delete the cache in each of them without having to add a new line for each site. For example I am using this:</p>
<pre><code>del /S /Q D:\www\site-name\cache\*
</code></pre>
<p>Which works, but I have to add a new line ... | 9,650 | 48,925 | 2010-03-31 22:23:44 | 2,556,793 | 12 | 2010-03-31 22:04:07 | 14,904 | 2010-03-31 22:09:46 | https://stackoverflow.com/q/2556778 | https://stackoverflow.com/a/2556793 | <p>I think this should work:</p>
<pre><code>for /D %%f in ("D:\www\*") do @(
del /S /Q "%%f\cache\*"
)
</code></pre>
| <p>I think this should work:</p> <pre><code>for /D %%f in ("D:\www\*") do @( del /S /Q "%%f\cache\*" ) </code></pre> | 5370, 5997, 7002 | batch-file, dos, wildcard | <h1>Writing a batch file to delete files with wildcards</h1>
<p>I have multiple websites set up in the same folder, and I want to create a batch file that will delete the cache in each of them without having to add a new line for each site. For example I am using this:</p>
<pre><code>del /S /Q D:\www\site-name\cache\*... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,532 | cmd | # Writing a batch file to delete files with wildcards
I have multiple websites set up in the same folder, and I want to create a batch file that will delete the cache in each of them without having to add a new line for each site. For example I am using this:
```
del /S /Q D:\www\site-name\cache\*
```
Which works, b... | I think this should work:
```
for /D %%f in ("D:\www\*") do @(
del /S /Q "%%f\cache\*"
)
``` |
65882526 | Expected more than 1 value per channel when training, got input size torch.Size([1, **]) | 6 | 2021-01-25 10:00:35 | <p>I met an error when I use BatchNorm1d, code:</p>
<pre><code>##% first I set a model
class net(nn.Module):
def __init__(self, max_len, feature_linear, rnn, input_size, hidden_size, output_dim, num__rnn_layers, bidirectional, batch_first=True, p=0.2):
super(net, self).__init__()
self.max_len = max_... | 11,572 | 14,629,714 | 2022-05-13 18:19:54 | 65,883,030 | 12 | 2021-01-25 10:35:21 | 1,714,410 | 2021-01-25 10:35:21 | https://stackoverflow.com/q/65882526 | https://stackoverflow.com/a/65883030 | <p>what does <a href="https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm1d.html#torch.nn.BatchNorm1d" rel="noreferrer"><code>BatchNorm1d</code></a> do mathematically?<br />
try and write down the equation for the case of <code>batch_size=1</code> and you'll understand why pytorch is angry with you.</p>
<p>How... | <p>what does <a href="https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm1d.html#torch.nn.BatchNorm1d" rel="noreferrer"><code>BatchNorm1d</code></a> do mathematically?<br /> try and write down the equation for the case of <code>batch_size=1</code> and you'll understand why pytorch is angry with you.</p> <p>How... | 124253, 124994 | batch-normalization, pytorch | <h1>Expected more than 1 value per channel when training, got input size torch.Size([1, **])</h1>
<p>I met an error when I use BatchNorm1d, code:</p>
<pre><code>##% first I set a model
class net(nn.Module):
def __init__(self, max_len, feature_linear, rnn, input_size, hidden_size, output_dim, num__rnn_layers, bidire... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,533 | cmd | # Expected more than 1 value per channel when training, got input size torch.Size([1, **])
I met an error when I use BatchNorm1d, code:
```
##% first I set a model
class net(nn.Module):
def __init__(self, max_len, feature_linear, rnn, input_size, hidden_size, output_dim, num__rnn_layers, bidirectional, batch_firs... | what does [`BatchNorm1d`](https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm1d.html#torch.nn.BatchNorm1d) do mathematically?
try and write down the equation for the case of `batch_size=1` and you'll understand why pytorch is angry with you.
How to solve it?
It is simple: `BatchNorm` has two "modes of ope... |
39055349 | Difference between call and cmd /c in windows batch | 6 | 2016-08-20 14:42:49 | <p>Can someone please explain what's the difference between </p>
<pre><code>call someBatchFile.bat ...
</code></pre>
<p>And </p>
<pre><code>cmd /C someBatchFile.bat ...
</code></pre>
<p>They both were suggested to me as solutions to <a href="https://stackoverflow.com/q/39049641/2316433">this</a> problem, but I don'... | 10,296 | 2,316,433 | 2016-08-20 18:01:32 | 39,057,200 | 12 | 2016-08-20 18:01:32 | 778,560 | 2016-08-20 18:01:32 | https://stackoverflow.com/q/39055349 | https://stackoverflow.com/a/39057200 | <p>The difference is that <code>call</code> execute the other Batch file <em>in the same context</em> of the caller program, so they share the same environment variables and other status (like <code>echo ON/OFF</code> or delayed expansion), whereas <code>cmd /C</code> execute the other Batch file in an entirely separat... | <p>The difference is that <code>call</code> execute the other Batch file <em>in the same context</em> of the caller program, so they share the same environment variables and other status (like <code>echo ON/OFF</code> or delayed expansion), whereas <code>cmd /C</code> execute the other Batch file in an entirely separat... | 64, 2631, 7002, 8632 | batch-file, call, cmd, windows | <h1>Difference between call and cmd /c in windows batch</h1>
<p>Can someone please explain what's the difference between </p>
<pre><code>call someBatchFile.bat ...
</code></pre>
<p>And </p>
<pre><code>cmd /C someBatchFile.bat ...
</code></pre>
<p>They both were suggested to me as solutions to <a href="https://stack... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,534 | cmd | # Difference between call and cmd /c in windows batch
Can someone please explain what's the difference between
```
call someBatchFile.bat ...
```
And
```
cmd /C someBatchFile.bat ...
```
They both were suggested to me as solutions to [this](https://stackoverflow.com/q/39049641/2316433) problem, but I don't underst... | The difference is that `call` execute the other Batch file *in the same context* of the caller program, so they share the same environment variables and other status (like `echo ON/OFF` or delayed expansion), whereas `cmd /C` execute the other Batch file in an entirely separated context, so any change made in the calle... |
37631601 | How to get each item of a comma separated string assigned to an environment variable processed within a loop? | 6 | 2016-06-04 14:55:16 | <p>The <strong>FOR</strong> loop only outputs the first item of the list and I'm trying to go over the whole list.</p>
<pre><code>@ECHO OFF
set list=this,is,a,list
FOR /f "tokens=1* delims=," %%a IN ("%list%") DO echo %%a
pause
</code></pre>
| 14,644 | 6,145,977 | 2022-05-06 17:37:24 | 37,633,325 | 12 | 2016-06-04 17:53:19 | 778,560 | 2016-06-04 17:53:19 | https://stackoverflow.com/q/37631601 | https://stackoverflow.com/a/37633325 | <p>The <code>FOR /F</code> command split a line in several <em>tokens</em>, that must be referenced individually via separate letters:</p>
<pre><code>@ECHO OFF
set list=this,is,a,list
FOR /f "tokens=1-4 delims=," %%a IN ("%list%") DO (
echo %%a
echo %%b
echo %%c
echo %%d
)
pause
</code></pre>
<p>The plain... | <p>The <code>FOR /F</code> command split a line in several <em>tokens</em>, that must be referenced individually via separate letters:</p> <pre><code>@ECHO OFF set list=this,is,a,list FOR /f "tokens=1-4 delims=," %%a IN ("%list%") DO ( echo %%a echo %%b echo %%c echo %%d ) pause </code></pre> <p>The plain... | 2531, 7002 | batch-file, for-loop | <h1>How to get each item of a comma separated string assigned to an environment variable processed within a loop?</h1>
<p>The <strong>FOR</strong> loop only outputs the first item of the list and I'm trying to go over the whole list.</p>
<pre><code>@ECHO OFF
set list=this,is,a,list
FOR /f "tokens=1* delims=," %%a IN (... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,535 | cmd | # How to get each item of a comma separated string assigned to an environment variable processed within a loop?
The **FOR** loop only outputs the first item of the list and I'm trying to go over the whole list.
```
@ECHO OFF
set list=this,is,a,list
FOR /f "tokens=1* delims=," %%a IN ("%list%") DO echo %%a
pause
``` | The `FOR /F` command split a line in several *tokens*, that must be referenced individually via separate letters:
```
@ECHO OFF
set list=this,is,a,list
FOR /f "tokens=1-4 delims=," %%a IN ("%list%") DO (
echo %%a
echo %%b
echo %%c
echo %%d
)
pause
```
The plain `FOR` command process a series of elements s... |
30408918 | Composer exit batch file after finish execution | 6 | 2015-05-23 04:34:50 | <p>I am trying to do some automation with batch file to perform installing of laravel and then continue with moving files & folder.</p>
<p>My batch file looks something like this:</p>
<pre><code>@echo off
echo Installing laravel...
composer create-project laravel/laravel system --prefer-dist
echo Laravel instal... | 1,942 | 1,995,781 | 2015-05-23 16:48:55 | 30,415,228 | 12 | 2015-05-23 16:48:55 | 778,560 | 2015-05-23 16:48:55 | https://stackoverflow.com/q/30408918 | https://stackoverflow.com/a/30415228 | <p>I could bet that the installer is a <code>composer.bat</code> Batch file! If so, execute it via <code>call</code> command:</p>
<pre><code>@echo off
echo Installing laravel...
call composer create-project laravel/laravel system --prefer-dist
echo Laravel installing is done... Now moving files and folder...
</code>... | <p>I could bet that the installer is a <code>composer.bat</code> Batch file! If so, execute it via <code>call</code> command:</p> <pre><code>@echo off echo Installing laravel... call composer create-project laravel/laravel system --prefer-dist echo Laravel installing is done... Now moving files and folder... </code>... | 5, 7002, 78546 | batch-file, composer-php, php | <h1>Composer exit batch file after finish execution</h1>
<p>I am trying to do some automation with batch file to perform installing of laravel and then continue with moving files & folder.</p>
<p>My batch file looks something like this:</p>
<pre><code>@echo off
echo Installing laravel...
composer create-project ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,537 | cmd | # Composer exit batch file after finish execution
I am trying to do some automation with batch file to perform installing of laravel and then continue with moving files & folder.
My batch file looks something like this:
```
@echo off
echo Installing laravel...
composer create-project laravel/laravel system --prefer... | I could bet that the installer is a `composer.bat` Batch file! If so, execute it via `call` command:
```
@echo off
echo Installing laravel...
call composer create-project laravel/laravel system --prefer-dist
echo Laravel installing is done... Now moving files and folder...
``` |
28212148 | How to run a command from a batch file and immediately return? | 6 | 2015-01-29 10:19:51 | <p>When I am on the command line and do this:</p>
<pre><code>"C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:log
</code></pre>
<p>a GUI dialog of <a href="https://code.google.com/p/tortoisegit/" rel="noreferrer">TortoiseGit</a> is opened and cmd.exe immediately returns, meaning that I can immediately ... | 10,509 | 21,728 | 2016-03-12 12:27:03 | 28,213,008 | 12 | 2015-01-29 10:59:47 | 2,861,476 | 2015-01-29 10:59:47 | https://stackoverflow.com/q/28212148 | https://stackoverflow.com/a/28213008 | <p>The answer from Oscar is almost correct, but needs a correction</p>
<pre><code>start "" "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:%1 %*
</code></pre>
<p>Why?</p>
<p><code>start</code> command has a curious behaviour: the first quoted argument is used to determine the title of a new <code>cmd... | <p>The answer from Oscar is almost correct, but needs a correction</p> <pre><code>start "" "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:%1 %* </code></pre> <p>Why?</p> <p><code>start</code> command has a curious behaviour: the first quoted argument is used to determine the title of a new <code>cmd... | 64, 2631, 7002, 31409 | batch-file, cmd, tortoisegit, windows | <h1>How to run a command from a batch file and immediately return?</h1>
<p>When I am on the command line and do this:</p>
<pre><code>"C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:log
</code></pre>
<p>a GUI dialog of <a href="https://code.google.com/p/tortoisegit/" rel="noreferrer">TortoiseGit</a> is... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,538 | cmd | # How to run a command from a batch file and immediately return?
When I am on the command line and do this:
```
"C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:log
```
a GUI dialog of [TortoiseGit](https://code.google.com/p/tortoisegit/) is opened and cmd.exe immediately returns, meaning that I can i... | The answer from Oscar is almost correct, but needs a correction
```
start "" "C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe" /command:%1 %*
```
Why?
`start` command has a curious behaviour: the first quoted argument is used to determine the title of a new `cmd` window, and no, it doesn't matter that no `cmd` ... |
21348579 | Check if label exists cmd | 6 | 2014-01-25 08:54:27 | <p>I wonder is there any way to check that if a label exist in a batch file?</p>
<pre><code>If %input%=ABC (
If Label ABC Exists (
Goto ABC
)
)
</code></pre>
<p>How can I do this?
Any help will be appreciated.</p>
| 4,984 | 3,222,831 | 2020-02-01 08:44:03 | 21,348,624 | 12 | 2014-01-25 09:01:08 | 2,861,476 | 2014-01-27 11:16:49 | https://stackoverflow.com/q/21348579 | https://stackoverflow.com/a/21348624 | <pre><code>findstr /i /r /c:"^[ ]*:%input%\>" "%~f0" >nul 2>nul && goto %input%
</code></pre>
<p>Search the label in the current batch file and if no errorlevel, label exists</p>
<p>EDITED - I realized there was an error on the way i was handling the end of the label and was going to edit the answer ... | <pre><code>findstr /i /r /c:"^[ ]*:%input%\>" "%~f0" >nul 2>nul && goto %input% </code></pre> <p>Search the label in the current batch file and if no errorlevel, label exists</p> <p>EDITED - I realized there was an error on the way i was handling the end of the label and was going to edit the answer ... | 2631, 7002 | batch-file, cmd | <h1>Check if label exists cmd</h1>
<p>I wonder is there any way to check that if a label exist in a batch file?</p>
<pre><code>If %input%=ABC (
If Label ABC Exists (
Goto ABC
)
)
</code></pre>
<p>How can I do this?
Any help will be appreciated.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,539 | cmd | # Check if label exists cmd
I wonder is there any way to check that if a label exist in a batch file?
```
If %input%=ABC (
If Label ABC Exists (
Goto ABC
)
)
```
How can I do this?
Any help will be appreciated. | ```
findstr /i /r /c:"^[ ]*:%input%\>" "%~f0" >nul 2>nul && goto %input%
```
Search the label in the current batch file and if no errorlevel, label exists
EDITED - I realized there was an error on the way i was handling the end of the label and was going to edit the answer (it has been edited anyway) and i see the db... |
20603599 | How to Open only UserForm of an excel macro from batch file | 6 | 2013-12-16 04:41:18 | <p>I'm trying to open the UserForm1 of an excel macro through batch file. I'm able to open that but excel is also getting opened along with that. I want only UserForm1 to be opened not the excel. Below is my approach :</p>
<p>I have written a macros to open the UserForm1</p>
<pre><code>Sub open_form()
UserForm1.Sh... | 50,130 | 3,003,807 | 2015-01-30 14:30:48 | 20,603,619 | 12 | 2013-12-16 04:44:49 | 1,140,579 | 2013-12-16 05:13:50 | https://stackoverflow.com/q/20603599 | https://stackoverflow.com/a/20603619 | <p>You need to show the <code>UserForm</code> in <code>modeless</code> mode and then hide the application.</p>
<p>try this</p>
<pre><code>Sub open_form()
Application.Visible = False
UserForm1.Show vbModeless
End Sub
</code></pre>
<p>and either in a button you need to set it back to true or you can use the <c... | <p>You need to show the <code>UserForm</code> in <code>modeless</code> mode and then hide the application.</p> <p>try this</p> <pre><code>Sub open_form() Application.Visible = False UserForm1.Show vbModeless End Sub </code></pre> <p>and either in a button you need to set it back to true or you can use the <c... | 522, 1449, 7002 | batch-file, excel, vba | <h1>How to Open only UserForm of an excel macro from batch file</h1>
<p>I'm trying to open the UserForm1 of an excel macro through batch file. I'm able to open that but excel is also getting opened along with that. I want only UserForm1 to be opened not the excel. Below is my approach :</p>
<p>I have written a macros ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,540 | cmd | # How to Open only UserForm of an excel macro from batch file
I'm trying to open the UserForm1 of an excel macro through batch file. I'm able to open that but excel is also getting opened along with that. I want only UserForm1 to be opened not the excel. Below is my approach :
I have written a macros to open the User... | You need to show the `UserForm` in `modeless` mode and then hide the application.
try this
```
Sub open_form()
Application.Visible = False
UserForm1.Show vbModeless
End Sub
```
and either in a button you need to set it back to true or you can use the `UserForm_QueryClose` event
```
Private Sub UserForm_Quer... |
16810879 | Batch R Script - setting the working directory and selecting output folder | 6 | 2013-05-29 09:59:26 | <p>I've been digging into several places for 2 simple needs but couldn't find a final answer.</p>
<p>I'm running an R script in batch mode. Not sure whether my solution is the best one but I'm using R CMD BATCH as per <a href="http://stat.ethz.ch/R-manual/R-patched/library/utils/html/BATCH.html" rel="noreferrer">http:... | 6,129 | 2,431,750 | 2013-05-29 10:22:31 | 16,811,380 | 12 | 2013-05-29 10:22:31 | 1,838,509 | 2013-05-29 10:22:31 | https://stackoverflow.com/q/16810879 | https://stackoverflow.com/a/16811380 | <p>You don't give code so my answer will be just an advise or what I would do for such job.</p>
<ol>
<li>Use <code>Rscript.exe</code> it is the way to go for batch script. R CMD is a sort of legacy tool.</li>
<li>You don't need to set or change the working directory. It is a source of problems</li>
<li><p>You can laun... | <p>You don't give code so my answer will be just an advise or what I would do for such job.</p> <ol> <li>Use <code>Rscript.exe</code> it is the way to go for batch script. R CMD is a sort of legacy tool.</li> <li>You don't need to set or change the working directory. It is a source of problems</li> <li><p>You can laun... | 4452, 7002, 10201 | batch-file, r, working-directory | <h1>Batch R Script - setting the working directory and selecting output folder</h1>
<p>I've been digging into several places for 2 simple needs but couldn't find a final answer.</p>
<p>I'm running an R script in batch mode. Not sure whether my solution is the best one but I'm using R CMD BATCH as per <a href="http://s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,541 | cmd | # Batch R Script - setting the working directory and selecting output folder
I've been digging into several places for 2 simple needs but couldn't find a final answer.
I'm running an R script in batch mode. Not sure whether my solution is the best one but I'm using R CMD BATCH as per <http://stat.ethz.ch/R-manual/R-p... | You don't give code so my answer will be just an advise or what I would do for such job.
1. Use `Rscript.exe` it is the way to go for batch script. R CMD is a sort of legacy tool.
2. You don't need to set or change the working directory. It is a source of problems
3. You can launch you bat file where you want and with... |
16414672 | windows command line multiple commands | 6 | 2013-05-07 08:34:20 | <p>I am opening 3 cmd windows in different colours to help me distinguish between servers etc. These commands are in a <code>.bat</code> file.</p>
<pre><code>start cmd /k color 4C
start cmd /k color 5D
start cmd /k color 2A
</code></pre>
<p>What I need to do is have them open up at a specific location but I can't s... | 5,793 | 164,142 | 2013-05-07 09:29:46 | 16,414,706 | 12 | 2013-05-07 08:36:48 | 15,498 | 2013-05-07 08:50:04 | https://stackoverflow.com/q/16414672 | https://stackoverflow.com/a/16414706 | <p>Use <code>&</code>:</p>
<pre><code>start cmd /k "color 4C & cd \"
</code></pre>
<p>You have to quote the commands now, otherwise the <code>&</code> is consumed by the outer command prompt (e.g. the one running the batch file) rather than the newly launched one.</p>
<hr>
<p>You also have another optio... | <p>Use <code>&</code>:</p> <pre><code>start cmd /k "color 4C & cd \" </code></pre> <p>You have to quote the commands now, otherwise the <code>&</code> is consumed by the outer command prompt (e.g. the one running the batch file) rather than the newly launched one.</p> <hr> <p>You also have another optio... | 64, 2631 | cmd, windows | <h1>windows command line multiple commands</h1>
<p>I am opening 3 cmd windows in different colours to help me distinguish between servers etc. These commands are in a <code>.bat</code> file.</p>
<pre><code>start cmd /k color 4C
start cmd /k color 5D
start cmd /k color 2A
</code></pre>
<p>What I need to do is have t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,542 | cmd | # windows command line multiple commands
I am opening 3 cmd windows in different colours to help me distinguish between servers etc. These commands are in a `.bat` file.
```
start cmd /k color 4C
start cmd /k color 5D
start cmd /k color 2A
```
What I need to do is have them open up at a specific location but I can'... | Use `&`:
```
start cmd /k "color 4C & cd \"
```
You have to quote the commands now, otherwise the `&` is consumed by the outer command prompt (e.g. the one running the batch file) rather than the newly launched one.
---
You also have another option - so far as I'm aware, a newly launched command prompt inherits the... |
16158083 | Skip Microsoft's message at beginning of a file | 6 | 2013-04-22 22:53:53 | <p>When running a vbs script from a bat file, it is sometimes written in header output file </p>
<pre><code>Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation 1996-2001. Tous droits r‚serv‚s
example: cscript myvbs.vbs file.txt >result.txt
</code></pre>
<p>I know that doing more +2 o... | 6,390 | 2,259,897 | 2023-04-18 16:06:40 | 16,158,101 | 12 | 2013-04-22 22:55:58 | 30,225 | 2013-04-22 22:55:58 | https://stackoverflow.com/q/16158083 | https://stackoverflow.com/a/16158101 | <p>Try the <code>//Nologo Prevent logo display: No banner will be shown at execution time</code></p>
<pre><code>C:\>cscript
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
Usage: CScript scriptname.extension [option...] [arguments...]
Options:
//B ... | <p>Try the <code>//Nologo Prevent logo display: No banner will be shown at execution time</code></p> <pre><code>C:\>cscript Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. Usage: CScript scriptname.extension [option...] [arguments...] Options: //B ... | 494, 7002 | batch-file, vbscript | <h1>Skip Microsoft's message at beginning of a file</h1>
<p>When running a vbs script from a bat file, it is sometimes written in header output file </p>
<pre><code>Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation 1996-2001. Tous droits r‚serv‚s
example: cscript myvbs.vbs file.txt >... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,543 | cmd | # Skip Microsoft's message at beginning of a file
When running a vbs script from a bat file, it is sometimes written in header output file
```
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation 1996-2001. Tous droits r‚serv‚s
example: cscript myvbs.vbs file.txt >result.txt
```
I know ... | Try the `//Nologo Prevent logo display: No banner will be shown at execution time`
```
C:\>cscript
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
Usage: CScript scriptname.extension [option...] [arguments...]
Options:
//B Batch mode: Suppresses script... |
14602890 | Batch file creating another batch file, how to ignore commands when writing lines? | 6 | 2013-01-30 11:27:18 | <p>having a bit of trouble with a windows batch file I'm writing.</p>
<p>I need the batch file to write some particular lines to another batch file, the method I have been using is:</p>
<pre><code>type NUL > batchfile.bat
ECHO texttobewrittentofile >> batchfile.bat
ECHO texttobewrittentofile >> batchfi... | 22,299 | 1,691,708 | 2016-08-29 09:02:37 | 14,604,414 | 12 | 2013-01-30 12:48:26 | 1,012,053 | 2013-01-30 13:46:25 | https://stackoverflow.com/q/14602890 | https://stackoverflow.com/a/14604414 | <p>All special characters like <code>^</code> <code>&</code> <code>|</code> <code><</code> <code>></code> must be escaped as <code>^^</code> <code>^&</code> <code>^|</code> <code>^<</code> <code>^></code> or else enclosed in quotes.</p>
<p>Every percent must be doubled always. For example:</p>
<ul... | <p>All special characters like <code>^</code> <code>&</code> <code>|</code> <code><</code> <code>></code> must be escaped as <code>^^</code> <code>^&</code> <code>^|</code> <code>^<</code> <code>^></code> or else enclosed in quotes.</p> <p>Every percent must be doubled always. For example:</p> <ul... | 1469, 2743, 7002, 13824 | batch-file, echo, symbols, text | <h1>Batch file creating another batch file, how to ignore commands when writing lines?</h1>
<p>having a bit of trouble with a windows batch file I'm writing.</p>
<p>I need the batch file to write some particular lines to another batch file, the method I have been using is:</p>
<pre><code>type NUL > batchfile.bat
E... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,544 | cmd | # Batch file creating another batch file, how to ignore commands when writing lines?
having a bit of trouble with a windows batch file I'm writing.
I need the batch file to write some particular lines to another batch file, the method I have been using is:
```
type NUL > batchfile.bat
ECHO texttobewrittentofile >> b... | All special characters like `^` `&` `|` `<` `>` must be escaped as `^^` `^&` `^|` `^<` `^>` or else enclosed in quotes.
Every percent must be doubled always. For example:
- `"%1"` becomes `"%%1"`
- `%newest%` becomes `%%newest%%`
- `%%a` becomes `%%%%a`
You don't need to clear the output file and redirect each line ... |
14274360 | Want to hide the cmd prompt screen | 6 | 2013-01-11 08:36:30 | <p>I have developed a utility which will get time of all servers in the list. </p>
<pre><code>System.Diagnostics.Process p;
string server_name = "";
string[] output;
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "net";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Sta... | 7,146 | 415,180 | 2014-10-10 16:15:41 | 14,274,382 | 12 | 2013-01-11 08:38:29 | 524,475 | 2013-01-11 08:38:29 | https://stackoverflow.com/q/14274360 | https://stackoverflow.com/a/14274382 | <p>You can tell the process to use no window or to minimize it:</p>
<pre><code>// don't execute on shell
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
// don't show window
p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
</code></pre>
<p>with <code>UseShellExecute = false</code> you ... | <p>You can tell the process to use no window or to minimize it:</p> <pre><code>// don't execute on shell p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; // don't show window p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; </code></pre> <p>with <code>UseShellExecute = false</code> you ... | 1, 9, 1796, 2631 | .net, c#, cmd, command | <h1>Want to hide the cmd prompt screen</h1>
<p>I have developed a utility which will get time of all servers in the list. </p>
<pre><code>System.Diagnostics.Process p;
string server_name = "";
string[] output;
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "net";
p.StartInfo.UseShellExecute = false;
p.St... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,545 | cmd | # Want to hide the cmd prompt screen
I have developed a utility which will get time of all servers in the list.
```
System.Diagnostics.Process p;
string server_name = "";
string[] output;
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "net";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStand... | You can tell the process to use no window or to minimize it:
```
// don't execute on shell
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
// don't show window
p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
```
with `UseShellExecute = false` you may redirect the output:
```
// redir... |
12972670 | Delete a folder which name starts with something in command prompt (batch) | 6 | 2012-10-19 10:49:46 | <p>I read and tried some code from </p>
<ol>
<li><p><a href="https://stackoverflow.com/questions/186737/whats-the-fastest-way-to-delete-a-large-folder-in-windows">What's the fastest way to delete a large folder in Windows?</a> (<code>rmdir /s /q folder</code>)</p></li>
<li><p><a href="https://stackoverflow.com/que... | 8,309 | 998,696 | 2012-10-19 10:55:32 | 12,972,763 | 12 | 2012-10-19 10:55:19 | 799,586 | 2012-10-19 10:55:19 | https://stackoverflow.com/q/12972670 | https://stackoverflow.com/a/12972763 | <p>Here you go</p>
<pre><code>for /d %%a in (D:\Test_*) do rd %%a /q
</code></pre>
<p>The <code>for</code> loop is necessary as it seems <code>rd</code> doesn't support wildcards.</p>
| <p>Here you go</p> <pre><code>for /d %%a in (D:\Test_*) do rd %%a /q </code></pre> <p>The <code>for</code> loop is necessary as it seems <code>rd</code> doesn't support wildcards.</p> | 1796, 7002, 9938 | batch-file, command, command-prompt | <h1>Delete a folder which name starts with something in command prompt (batch)</h1>
<p>I read and tried some code from </p>
<ol>
<li><p><a href="https://stackoverflow.com/questions/186737/whats-the-fastest-way-to-delete-a-large-folder-in-windows">What's the fastest way to delete a large folder in Windows?</a> (<co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,546 | cmd | # Delete a folder which name starts with something in command prompt (batch)
I read and tried some code from
1. [What's the fastest way to delete a large folder in Windows?](https://stackoverflow.com/questions/186737/whats-the-fastest-way-to-delete-a-large-folder-in-windows) (`rmdir /s /q folder`)
2. [Delete Files wi... | Here you go
```
for /d %%a in (D:\Test_*) do rd %%a /q
```
The `for` loop is necessary as it seems `rd` doesn't support wildcards. |
10878138 | How to create %tab% in CMD | 6 | 2012-06-04 08:05:07 | <p>I need reliable way to create %tab% (containing one tab character) for both, Windows and XP.</p>
<pre><code>SET TAB=" "
</code></pre>
<p>Should work for Windows 7 (not tested) but not for Win XP (tested).</p>
<p>This</p>
<pre><code>for /F "skip=4 delims=pR tokens=1,2" %%a in ( 'reg query hkcu\environment /v temp... | 44,781 | 1,141,649 | 2021-10-14 08:04:51 | 10,879,650 | 12 | 2012-06-04 10:13:35 | 463,115 | 2012-06-04 10:13:35 | https://stackoverflow.com/q/10878138 | https://stackoverflow.com/a/10879650 | <p>You should use an editor which supports TAB characters without changing them to spaces.<br>
And you should reorder the quotes, as with <code>set TAB=" "</code> you got a variable with three characters.<br>
TAB contains then also the quotes. </p>
<pre><code>set "TAB= "
</code></pre>
<p>Currently there seems to be... | <p>You should use an editor which supports TAB characters without changing them to spaces.<br> And you should reorder the quotes, as with <code>set TAB=" "</code> you got a variable with three characters.<br> TAB contains then also the quotes. </p> <pre><code>set "TAB= " </code></pre> <p>Currently there seems to be... | 1177, 2631, 7002 | batch-file, cmd, tabs | <h1>How to create %tab% in CMD</h1>
<p>I need reliable way to create %tab% (containing one tab character) for both, Windows and XP.</p>
<pre><code>SET TAB=" "
</code></pre>
<p>Should work for Windows 7 (not tested) but not for Win XP (tested).</p>
<p>This</p>
<pre><code>for /F "skip=4 delims=pR tokens=1,2" %%a in (... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,547 | cmd | # How to create %tab% in CMD
I need reliable way to create %tab% (containing one tab character) for both, Windows and XP.
```
SET TAB=" "
```
Should work for Windows 7 (not tested) but not for Win XP (tested).
This
```
for /F "skip=4 delims=pR tokens=1,2" %%a in ( 'reg query hkcu\environment /v temp' ) do set TAB=... | You should use an editor which supports TAB characters without changing them to spaces.
And you should reorder the quotes, as with `set TAB=" "` you got a variable with three characters.
TAB contains then also the quotes.
```
set "TAB= "
```
Currently there seems to be no reliable way to use a program to create... |
9087691 | Spring Batch Multi Threading - How to make each thread read unique records? | 6 | 2012-01-31 22:06:25 | <p>This question has been asked a lot of times in many forums. But I don't see an answer that fits me. I am trying to implement Multi-threaded Step in my spring batch implementation. </p>
<ol>
<li><p>Have a staging table with 100k records </p></li>
<li><p>Want to process it in 10 threads of commit interval 300 per thr... | 18,868 | 146,345 | 2017-07-05 14:05:11 | 9,105,194 | 12 | 2012-02-01 23:53:18 | 211,277 | 2017-07-05 14:05:11 | https://stackoverflow.com/q/9087691 | https://stackoverflow.com/a/9105194 | <hr />
<ul>
<li><em>What i dont find is this? From where is this "run.id" coming from</em></li>
</ul>
<h2>JobParameters</h2>
<p>This is just a parameter that <em>you</em> pass to jobParameters. Usually a different <code>run.id</code> (a conventional name) for each instance is used because the framework has no... | <hr /> <ul> <li><em>What i dont find is this? From where is this "run.id" coming from</em></li> </ul> <h2>JobParameters</h2> <p>This is just a parameter that <em>you</em> pass to jobParameters. Usually a different <code>run.id</code> (a conventional name) for each instance is used because the framework has no... | 17, 1211, 1381, 41895 | java, multithreading, spring, spring-batch | <h1>Spring Batch Multi Threading - How to make each thread read unique records?</h1>
<p>This question has been asked a lot of times in many forums. But I don't see an answer that fits me. I am trying to implement Multi-threaded Step in my spring batch implementation. </p>
<ol>
<li><p>Have a staging table with 100k rec... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,548 | cmd | # Spring Batch Multi Threading - How to make each thread read unique records?
This question has been asked a lot of times in many forums. But I don't see an answer that fits me. I am trying to implement Multi-threaded Step in my spring batch implementation.
1. Have a staging table with 100k records
2. Want to process... | ---
- *What i dont find is this? From where is this "run.id" coming from*
## JobParameters
This is just a parameter that *you* pass to jobParameters. Usually a different `run.id` (a conventional name) for each instance is used because the framework has no way of knowing what changes to the JobParameters make it the ... |
8976287 | Recursive Unzipping with 7z.exe | 6 | 2012-01-23 17:56:43 | <p>I stumbled across the below line as a means of extracting every .zip file in every subfolder. </p>
<pre><code>FOR /F "usebackq" %a in (`DIR /s /b *.zip`) do 7z.exe e %a
</code></pre>
<p>I've tried this on a WinXP cmd.exe prompt and I get the error:</p>
<pre><code>"a was unexpected at this time."
</code></pre>
<p... | 25,137 | 1,766,790 | 2013-09-19 20:59:41 | 8,978,591 | 12 | 2012-01-23 21:09:15 | 604,015 | 2012-01-23 21:09:15 | https://stackoverflow.com/q/8976287 | https://stackoverflow.com/a/8978591 | <p>Try to change <strong>%a</strong> with <strong>%%a</strong>:</p>
<pre><code>FOR /F "usebackq" %%a in (`DIR /s /b *.zip`) do 7z.exe e %%a
</code></pre>
| <p>Try to change <strong>%a</strong> with <strong>%%a</strong>:</p> <pre><code>FOR /F "usebackq" %%a in (`DIR /s /b *.zip`) do 7z.exe e %%a </code></pre> | 64, 5680, 7002, 7597 | 7zip, batch-file, unzip, windows | <h1>Recursive Unzipping with 7z.exe</h1>
<p>I stumbled across the below line as a means of extracting every .zip file in every subfolder. </p>
<pre><code>FOR /F "usebackq" %a in (`DIR /s /b *.zip`) do 7z.exe e %a
</code></pre>
<p>I've tried this on a WinXP cmd.exe prompt and I get the error:</p>
<pre><code>"a was un... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,549 | cmd | # Recursive Unzipping with 7z.exe
I stumbled across the below line as a means of extracting every .zip file in every subfolder.
```
FOR /F "usebackq" %a in (`DIR /s /b *.zip`) do 7z.exe e %a
```
I've tried this on a WinXP cmd.exe prompt and I get the error:
```
"a was unexpected at this time."
```
Can somebody ple... | Try to change **%a** with **%%a**:
```
FOR /F "usebackq" %%a in (`DIR /s /b *.zip`) do 7z.exe e %%a
``` |
6498460 | Batch Programming, Error Handling, and Start Command | 6 | 2011-06-27 20:20:04 | <p>I am just starting to learn how to script. I'm trying to understand how the system handles Error Levels and how they can be used in error handling. I know there is a difference between the environment variable %ERRORLEVEL% and the Error Level of the system. If I understand this correctly, then the
<code>If ERRORLEVE... | 38,225 | 818,073 | 2011-06-30 16:26:50 | 6,527,436 | 12 | 2011-06-29 21:24:06 | 821,878 | 2011-06-29 21:24:06 | https://stackoverflow.com/q/6498460 | https://stackoverflow.com/a/6527436 | <p>You should never SET the %errorlevel% variable. You are correct that there is a difference; The errorlevel that you get from an exiting process is an internal register that you can read with the %errorlevel% syntax. However, if you create a variable named ERRORLEVEL, it will mask the internal register and you lose... | <p>You should never SET the %errorlevel% variable. You are correct that there is a difference; The errorlevel that you get from an exiting process is an internal register that you can read with the %errorlevel% syntax. However, if you create a variable named ERRORLEVEL, it will mask the internal register and you lose... | 379, 7002 | batch-file, error-handling | <h1>Batch Programming, Error Handling, and Start Command</h1>
<p>I am just starting to learn how to script. I'm trying to understand how the system handles Error Levels and how they can be used in error handling. I know there is a difference between the environment variable %ERRORLEVEL% and the Error Level of the syste... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,550 | cmd | # Batch Programming, Error Handling, and Start Command
I am just starting to learn how to script. I'm trying to understand how the system handles Error Levels and how they can be used in error handling. I know there is a difference between the environment variable %ERRORLEVEL% and the Error Level of the system. If I u... | You should never SET the %errorlevel% variable. You are correct that there is a difference; The errorlevel that you get from an exiting process is an internal register that you can read with the %errorlevel% syntax. However, if you create a variable named ERRORLEVEL, it will mask the internal register and you lose acce... |
5308955 | What does this BatchUpdateException mean? | 6 | 2011-03-15 08:05:58 | <p>I'm getting this BatchUpdateException from a stmt.executeBatch() statement:</p>
<pre><code>BatchUpdateException: A resultset was created for update
</code></pre>
<p>The internet does not have any information on this exception message. What does it mean? The traceback doesn't contain anything useful other than that... | 15,759 | 189,247 | 2014-07-03 11:44:49 | 5,309,201 | 12 | 2011-03-15 08:34:36 | 40,342 | 2011-03-15 08:34:36 | https://stackoverflow.com/q/5308955 | https://stackoverflow.com/a/5309201 | <p>I'd interpret the message as meaning that an SQL statement that you added via <code>addBatch()</code> has produced a <code>ResultSet</code>, meaning that it's not your normal <code>INSERT</code>, <code>UPDATE</code> or <code>DELETE</code> statement.</p>
<p>Statements that should return results can't be executed in ... | <p>I'd interpret the message as meaning that an SQL statement that you added via <code>addBatch()</code> has produced a <code>ResultSet</code>, meaning that it's not your normal <code>INSERT</code>, <code>UPDATE</code> or <code>DELETE</code> statement.</p> <p>Statements that should return results can't be executed in ... | 17, 5142, 5822, 35561 | batch-updates, exception, java, sqlexception | <h1>What does this BatchUpdateException mean?</h1>
<p>I'm getting this BatchUpdateException from a stmt.executeBatch() statement:</p>
<pre><code>BatchUpdateException: A resultset was created for update
</code></pre>
<p>The internet does not have any information on this exception message. What does it mean? The traceb... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,551 | cmd | # What does this BatchUpdateException mean?
I'm getting this BatchUpdateException from a stmt.executeBatch() statement:
```
BatchUpdateException: A resultset was created for update
```
The internet does not have any information on this exception message. What does it mean? The traceback doesn't contain anything usef... | I'd interpret the message as meaning that an SQL statement that you added via `addBatch()` has produced a `ResultSet`, meaning that it's not your normal `INSERT`, `UPDATE` or `DELETE` statement.
Statements that should return results can't be executed in batches with JDBC.
The [JDBC Tutorial](http://download.oracle.co... |
4549043 | Batch process list | 6 | 2010-12-28 19:58:24 | <p>Is it possible to get process list in cmd/batch like in ctrl+alt+del/ctrl+shift+esc</p>
| 16,168 | 556,123 | 2013-07-10 13:02:32 | 4,549,088 | 12 | 2010-12-28 20:04:49 | 85,977 | 2010-12-28 20:04:49 | https://stackoverflow.com/q/4549043 | https://stackoverflow.com/a/4549088 | <p>A few ways:</p>
<p>You can use <code>tasklist</code>, <code>wmic process list</code> (on most Windows machines), or <code>get-process</code> if you are using Powershell.</p>
| <p>A few ways:</p> <p>You can use <code>tasklist</code>, <code>wmic process list</code> (on most Windows machines), or <code>get-process</code> if you are using Powershell.</p> | 7002 | batch-file | <h1>Batch process list</h1>
<p>Is it possible to get process list in cmd/batch like in ctrl+alt+del/ctrl+shift+esc</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,552 | cmd | # Batch process list
Is it possible to get process list in cmd/batch like in ctrl+alt+del/ctrl+shift+esc | A few ways:
You can use `tasklist`, `wmic process list` (on most Windows machines), or `get-process` if you are using Powershell. |
3951314 | How to create a batch file that accepts two integers as parameters | 6 | 2010-10-16 23:45:09 | <p>I am just beginning to learn command line scripts, and I have an assignment for school in which the first part is to create a batch file that accepts two integers as parameters. The integers will be subsequently manipulated throughout the question, and I am not looking for any help with that. I have googled this m... | 26,731 | 478,236 | 2010-10-17 03:18:51 | 3,951,344 | 12 | 2010-10-16 23:54:07 | 334,849 | 2010-10-17 00:07:33 | https://stackoverflow.com/q/3951314 | https://stackoverflow.com/a/3951344 | <p>Assuming MS-DOS, you can use <code>%1</code>, <code>%2</code>, etc. for input parameters.</p>
<pre><code>@ECHO OFF
SET /a INT1=%1
SET /a INT2=%2
SET /a ANSWER=INT1*INT2
ECHO %ANSWER%
PAUSE
</code></pre>
<p>You could then call this as:</p>
<pre><code>mybatchfile.bat 2 4
</code></pre>
| <p>Assuming MS-DOS, you can use <code>%1</code>, <code>%2</code>, etc. for input parameters.</p> <pre><code>@ECHO OFF SET /a INT1=%1 SET /a INT2=%2 SET /a ANSWER=INT1*INT2 ECHO %ANSWER% PAUSE </code></pre> <p>You could then call this as:</p> <pre><code>mybatchfile.bat 2 4 </code></pre> | 1231, 7002 | batch-file, command-line | <h1>How to create a batch file that accepts two integers as parameters</h1>
<p>I am just beginning to learn command line scripts, and I have an assignment for school in which the first part is to create a batch file that accepts two integers as parameters. The integers will be subsequently manipulated throughout the q... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,553 | cmd | # How to create a batch file that accepts two integers as parameters
I am just beginning to learn command line scripts, and I have an assignment for school in which the first part is to create a batch file that accepts two integers as parameters. The integers will be subsequently manipulated throughout the question, a... | Assuming MS-DOS, you can use `%1`, `%2`, etc. for input parameters.
```
@ECHO OFF
SET /a INT1=%1
SET /a INT2=%2
SET /a ANSWER=INT1*INT2
ECHO %ANSWER%
PAUSE
```
You could then call this as:
```
mybatchfile.bat 2 4
``` |
2569640 | DOS batch command to read some info from text file | 6 | 2010-04-02 23:01:53 | <p>I am trying to read some info from a text file by using windows command line, and save it to a variable just like "set info =1234"</p>
<p>Below is the content of the txt file, actually I just need the revision number, and the location of it is always the same line 5, and from column 11 to 15. In the sample it's 123... | 55,430 | 234,935 | 2010-04-03 19:09:14 | 2,569,837 | 12 | 2010-04-03 00:23:10 | 161,455 | 2010-04-03 00:23:10 | https://stackoverflow.com/q/2569640 | https://stackoverflow.com/a/2569837 | <p>Here's a one line version:</p>
<pre><code>for /f "tokens=2" %%i in ('findstr Revision: input.txt') do set revision=%%i
</code></pre>
<ol>
<li>findstr is used to filter the file. It will print "input.txt:Revision: 1234"</li>
<li>Then the "tokens=2" means that we are interested in the second token, "1234". By defa... | <p>Here's a one line version:</p> <pre><code>for /f "tokens=2" %%i in ('findstr Revision: input.txt') do set revision=%%i </code></pre> <ol> <li>findstr is used to filter the file. It will print "input.txt:Revision: 1234"</li> <li>Then the "tokens=2" means that we are interested in the second token, "1234". By defa... | 1231, 5370, 7002 | batch-file, command-line, dos | <h1>DOS batch command to read some info from text file</h1>
<p>I am trying to read some info from a text file by using windows command line, and save it to a variable just like "set info =1234"</p>
<p>Below is the content of the txt file, actually I just need the revision number, and the location of it is always the s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,554 | cmd | # DOS batch command to read some info from text file
I am trying to read some info from a text file by using windows command line, and save it to a variable just like "set info =1234"
Below is the content of the txt file, actually I just need the revision number, and the location of it is always the same line 5, and ... | Here's a one line version:
```
for /f "tokens=2" %%i in ('findstr Revision: input.txt') do set revision=%%i
```
1. findstr is used to filter the file. It will print "input.txt:Revision: 1234"
2. Then the "tokens=2" means that we are interested in the second token, "1234". By default for breaks on white space. |
21289762 | Remove unwanted path name from %path% variable via batch | 49 | 2014-01-22 17:27:25 | <p>Scope: Windows XP or newer
Tools: Batch script</p>
<p>I need to be able to remove an unneeded path name from the system %PATH% variable. I know how to add a new path name to the system %PATH% variable, using a tool such as SETX.EXE, which also makes it immediately available within the existing CMD environment. It... | 140,609 | 3,208,239 | 2023-12-21 21:39:00 | 21,292,905 | 11 | 2014-01-22 20:08:09 | 2,414,894 | 2014-01-22 20:08:09 | https://stackoverflow.com/q/21289762 | https://stackoverflow.com/a/21292905 | <p>You can try something like this :</p>
<pre><code>@echo off&cls
setlocal EnableDelayedExpansion
set $line=%path%
set $line=%$line: =#%
set $line=%$line:;= %
for %%a in (%$line%) do echo %%a | find /i "oracle" || set $newpath=!$newpath!;%%a
set $newpath=!$newpath:#= !
echo set path=!$newpath:~1!
</code></pre>
<... | <p>You can try something like this :</p> <pre><code>@echo off&cls setlocal EnableDelayedExpansion set $line=%path% set $line=%$line: =#% set $line=%$line:;= % for %%a in (%$line%) do echo %%a | find /i "oracle" || set $newpath=!$newpath!;%%a set $newpath=!$newpath:#= ! echo set path=!$newpath:~1! </code></pre> <... | 64, 6268, 7002 | batch-file, path, windows | <h1>Remove unwanted path name from %path% variable via batch</h1>
<p>Scope: Windows XP or newer
Tools: Batch script</p>
<p>I need to be able to remove an unneeded path name from the system %PATH% variable. I know how to add a new path name to the system %PATH% variable, using a tool such as SETX.EXE, which also make... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,555 | cmd | # Remove unwanted path name from %path% variable via batch
Scope: Windows XP or newer
Tools: Batch script
I need to be able to remove an unneeded path name from the system %PATH% variable. I know how to add a new path name to the system %PATH% variable, using a tool such as SETX.EXE, which also makes it immediately a... | You can try something like this :
```
@echo off&cls
setlocal EnableDelayedExpansion
set $line=%path%
set $line=%$line: =#%
set $line=%$line:;= %
for %%a in (%$line%) do echo %%a | find /i "oracle" || set $newpath=!$newpath!;%%a
set $newpath=!$newpath:#= !
echo set path=!$newpath:~1!
```
I putted an `echo` to the las... |
1118540 | How can I move the contents of one directory tree into another? | 26 | 2009-07-13 09:48:37 | <p>I have a directory which contains files and a number of levels of subdirectories:</p>
<pre><code>C:\Source
</code></pre>
<p>I would like to move the contents of C:\Source into:</p>
<pre><code>C:\Destination
</code></pre>
<p>Requirements:</p>
<ul>
<li>All files and all subdirectories
<em>within</em> C:\SourceDat... | 94,312 | 12,124 | 2018-03-22 03:25:41 | 1,118,678 | 11 | 2009-07-13 10:20:11 | 3,394 | 2009-07-13 12:05:51 | https://stackoverflow.com/q/1118540 | https://stackoverflow.com/a/1118678 | <p><strong>Update</strong>:</p>
<p>Adjusted code to a. check whether folders already exist at the destination, in which case move files in that folder over (and continue traversing the source directory structure), otherwise move the folder wholesale.</p>
<p>At the end of the script the source folder is removed altoge... | <p><strong>Update</strong>:</p> <p>Adjusted code to a. check whether folders already exist at the destination, in which case move files in that folder over (and continue traversing the source directory structure), otherwise move the folder wholesale.</p> <p>At the end of the script the source folder is removed altoge... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>How can I move the contents of one directory tree into another?</h1>
<p>I have a directory which contains files and a number of levels of subdirectories:</p>
<pre><code>C:\Source
</code></pre>
<p>I would like to move the contents of C:\Source into:</p>
<pre><code>C:\Destination
</code></pre>
<p>Requirements:</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,556 | cmd | # How can I move the contents of one directory tree into another?
I have a directory which contains files and a number of levels of subdirectories:
```
C:\Source
```
I would like to move the contents of C:\Source into:
```
C:\Destination
```
Requirements:
- All files and all subdirectories
*within* C:\SourceDat... | **Update**:
Adjusted code to a. check whether folders already exist at the destination, in which case move files in that folder over (and continue traversing the source directory structure), otherwise move the folder wholesale.
At the end of the script the source folder is removed altogether to eliminate these folder... |
9864620 | In batch, how do I create spaces at the beginning of a input prompt string? | 22 | 2012-03-25 22:20:42 | <p>Let's say I have a batch file that has "padding" in it, and I want to indent the beginning of the prompt string for the user to type in. If I use spaces, it will not show up when run, it just ignores the spaces. This script for an example:</p>
<pre><code>@echo off
echo.
echo.
echo Hi.
echo Please input somet... | 50,186 | 1,291,869 | 2023-10-13 15:45:52 | 9,865,960 | 11 | 2012-03-26 02:36:56 | 1,012,053 | 2012-03-26 10:27:26 | https://stackoverflow.com/q/9864620 | https://stackoverflow.com/a/9865960 | <p>As the comments above state, Vista and beyond strip leading spaces in a SET /P prompt.</p>
<p>The way to get around the problem is to define and use a backspace character in the prompt.</p>
<pre><code>::define a variable containing a single backspace character
for /f %%A in ('"prompt $H &echo on &for %%B i... | <p>As the comments above state, Vista and beyond strip leading spaces in a SET /P prompt.</p> <p>The way to get around the problem is to define and use a backspace character in the prompt.</p> <pre><code>::define a variable containing a single backspace character for /f %%A in ('"prompt $H &echo on &for %%B i... | 2631, 7002 | batch-file, cmd | <h1>In batch, how do I create spaces at the beginning of a input prompt string?</h1>
<p>Let's say I have a batch file that has "padding" in it, and I want to indent the beginning of the prompt string for the user to type in. If I use spaces, it will not show up when run, it just ignores the spaces. This script for an e... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,557 | cmd | # In batch, how do I create spaces at the beginning of a input prompt string?
Let's say I have a batch file that has "padding" in it, and I want to indent the beginning of the prompt string for the user to type in. If I use spaces, it will not show up when run, it just ignores the spaces. This script for an example:
... | As the comments above state, Vista and beyond strip leading spaces in a SET /P prompt.
The way to get around the problem is to define and use a backspace character in the prompt.
```
::define a variable containing a single backspace character
for /f %%A in ('"prompt $H &echo on &for %%B in (1) do rem"') do set BS=%%A... |
19162055 | psql shell uses code page 850, windows uses 1252. How to solve change console code page? | 19 | 2013-10-03 14:36:37 | <p>I have installed PostgreSQL, wanting to set up a new database, everything is going fine, until I am trying to use the € sign. And then I knew, that warning I get in the beginning is for a reason.</p>
<p>The warning I am getting at starting up my psql shell is: </p>
<pre><code>WARNING: Console code page (850) diffe... | 34,769 | 1,611,396 | 2024-01-23 21:57:44 | 24,821,954 | 11 | 2014-07-18 09:45:24 | 2,286,996 | 2014-07-18 09:45:24 | https://stackoverflow.com/q/19162055 | https://stackoverflow.com/a/24821954 | <p>What is your database Character Set? If it is UTF-8, then before running, what ever you want in psql, just tell the console to use the UTF-8 encoding:
<code>cmd.exe /c chcp 65001</code></p>
| <p>What is your database Character Set? If it is UTF-8, then before running, what ever you want in psql, just tell the console to use the UTF-8 encoding: <code>cmd.exe /c chcp 65001</code></p> | 64, 256, 2631, 2780, 14937 | cmd, codepages, localization, postgresql, windows | <h1>psql shell uses code page 850, windows uses 1252. How to solve change console code page?</h1>
<p>I have installed PostgreSQL, wanting to set up a new database, everything is going fine, until I am trying to use the € sign. And then I knew, that warning I get in the beginning is for a reason.</p>
<p>The warning I a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,558 | cmd | # psql shell uses code page 850, windows uses 1252. How to solve change console code page?
I have installed PostgreSQL, wanting to set up a new database, everything is going fine, until I am trying to use the € sign. And then I knew, that warning I get in the beginning is for a reason.
The warning I am getting at sta... | What is your database Character Set? If it is UTF-8, then before running, what ever you want in psql, just tell the console to use the UTF-8 encoding:
`cmd.exe /c chcp 65001` |
61916158 | Structure of winget source repositories | 16 | 2020-05-20 14:51:07 | <p>Microsoft announced and open-sourced <a href="https://github.com/microsoft/winget-cli" rel="nofollow noreferrer">winget</a>, a package manager for Windows.</p>
<p>When entering <code>winget source</code> (after installing it), it can be seen that it supports adding sources.</p>
<p><code>winget source</code> provides... | 16,470 | 10,871,900 | 2022-07-20 18:49:51 | 64,367,435 | 11 | 2020-10-15 08:14:06 | 14,454,250 | 2022-01-10 15:32:08 | https://stackoverflow.com/q/61916158 | https://stackoverflow.com/a/64367435 | <p>winget 1.0 <a href="https://devblogs.microsoft.com/commandline/windows-package-manager-1-0/" rel="noreferrer">introduced a new REST API</a> for custom repositories. The API and a reference implementation are provided by Microsoft at <a href="https://github.com/microsoft/winget-cli-restsource/" rel="noreferrer">githu... | <p>winget 1.0 <a href="https://devblogs.microsoft.com/commandline/windows-package-manager-1-0/" rel="noreferrer">introduced a new REST API</a> for custom repositories. The API and a reference implementation are provided by Microsoft at <a href="https://github.com/microsoft/winget-cli-restsource/" rel="noreferrer">githu... | 64, 2631, 8335, 144806 | cmd, package-managers, windows, winget | <h1>Structure of winget source repositories</h1>
<p>Microsoft announced and open-sourced <a href="https://github.com/microsoft/winget-cli" rel="nofollow noreferrer">winget</a>, a package manager for Windows.</p>
<p>When entering <code>winget source</code> (after installing it), it can be seen that it supports adding so... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,559 | cmd | # Structure of winget source repositories
Microsoft announced and open-sourced [winget](https://github.com/microsoft/winget-cli), a package manager for Windows.
When entering `winget source` (after installing it), it can be seen that it supports adding sources.
`winget source` provides the following subcommands:
``... | winget 1.0 [introduced a new REST API](https://devblogs.microsoft.com/commandline/windows-package-manager-1-0/) for custom repositories. The API and a reference implementation are provided by Microsoft at [github.com/microsoft/winget-cli-restsource/](https://github.com/microsoft/winget-cli-restsource/). The reference i... |
1503708 | Problem running .bat file on Windows due to "input line is too long" | 16 | 2009-10-01 12:36:52 | <p>I'm using Windows and have a batch file (contents attached below) where I'm building up a classpath before trying to run a Java class. Unfortunately the classpath is fairly big and the file ends up being ~14kb. When I run it I'm getting an 'input line too long' error. I have read elsewhere that the max. size for ... | 29,068 | 180,509 | 2016-10-19 10:17:50 | 1,504,039 | 11 | 2009-10-01 13:39:38 | 135,589 | 2009-10-01 13:39:38 | https://stackoverflow.com/q/1503708 | https://stackoverflow.com/a/1504039 | <p>If you are using Java 6, you can use a wildcard in the classpath, for example:</p>
<pre><code>java -cp libs/* com.mypackage.MyProgram
</code></pre>
<p>See <a href="http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html" rel="noreferrer">the documentation</a> (scroll down to "Understanding class p... | <p>If you are using Java 6, you can use a wildcard in the classpath, for example:</p> <pre><code>java -cp libs/* com.mypackage.MyProgram </code></pre> <p>See <a href="http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html" rel="noreferrer">the documentation</a> (scroll down to "Understanding class p... | 17, 64, 1231, 7002 | batch-file, command-line, java, windows | <h1>Problem running .bat file on Windows due to "input line is too long"</h1>
<p>I'm using Windows and have a batch file (contents attached below) where I'm building up a classpath before trying to run a Java class. Unfortunately the classpath is fairly big and the file ends up being ~14kb. When I run it I'm getting ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,560 | cmd | # Problem running .bat file on Windows due to "input line is too long"
I'm using Windows and have a batch file (contents attached below) where I'm building up a classpath before trying to run a Java class. Unfortunately the classpath is fairly big and the file ends up being ~14kb. When I run it I'm getting an 'input l... | If you are using Java 6, you can use a wildcard in the classpath, for example:
```
java -cp libs/* com.mypackage.MyProgram
```
See [the documentation](http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html) (scroll down to "Understanding class path wildcards") for more details.
Note: This doesn't w... |
31700520 | How to read all files in a folder with spring-batch and MultiResourceItemReader? | 15 | 2015-07-29 12:33:30 | <p>I want to configure <code>spring-batch</code> to read all <code>csv</code> files inside a specific folder sequentially.</p>
<p>The following does not work because the delegate will try to open a file named <code>*.csv</code>, which of course is invalid. What do I have to change here?</p>
<pre><code> @Bean
p... | 40,924 | 1,194,415 | 2021-04-23 08:35:44 | 31,710,152 | 11 | 2015-07-29 20:08:09 | 2,587,166 | 2015-07-29 20:08:09 | https://stackoverflow.com/q/31700520 | https://stackoverflow.com/a/31710152 | <p>I think you should use a <a href="http://docs.spring.io/spring/docs/4.0.0.RELEASE/javadoc-api/org/springframework/core/io/support/PathMatchingResourcePatternResolver.html" rel="noreferrer"><code>PathMatchingResourcePatternResolver</code></a>.</p>
| <p>I think you should use a <a href="http://docs.spring.io/spring/docs/4.0.0.RELEASE/javadoc-api/org/springframework/core/io/support/PathMatchingResourcePatternResolver.html" rel="noreferrer"><code>PathMatchingResourcePatternResolver</code></a>.</p> | 17, 218, 1211, 5310, 41895 | directory, file, java, spring, spring-batch | <h1>How to read all files in a folder with spring-batch and MultiResourceItemReader?</h1>
<p>I want to configure <code>spring-batch</code> to read all <code>csv</code> files inside a specific folder sequentially.</p>
<p>The following does not work because the delegate will try to open a file named <code>*.csv</code>, ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,561 | cmd | # How to read all files in a folder with spring-batch and MultiResourceItemReader?
I want to configure `spring-batch` to read all `csv` files inside a specific folder sequentially.
The following does not work because the delegate will try to open a file named `*.csv`, which of course is invalid. What do I have to cha... | I think you should use a [`PathMatchingResourcePatternResolver`](http://docs.spring.io/spring/docs/4.0.0.RELEASE/javadoc-api/org/springframework/core/io/support/PathMatchingResourcePatternResolver.html). |
20339341 | Why can I not get a substring of a delayed expansion variable in an if statement? | 15 | 2013-12-02 22:40:00 | <p>Why does string-manipulation work inline in an if statement without using delayed expansion variables - but fails otherwise. For example:</p>
<pre><code>set test=testString
if %test:~0,4%==test echo Success
</code></pre>
<p>This works correctly; returning <code>Success</code>. However if I do the following:</p>
<... | 5,243 | 2,844,742 | 2018-05-16 21:33:47 | 20,342,275 | 11 | 2013-12-03 03:22:56 | 1,012,053 | 2016-08-25 11:20:50 | https://stackoverflow.com/q/20339341 | https://stackoverflow.com/a/20342275 | <p>npocmaka correctly diagnosed the problem that the IF command gets its own special parsing phase, and token delimiters within the variable expansion are causing problems.</p>
<p>Substitution also causes a problem:</p>
<pre><code>:: This fails
if !test:String=!==test echo Success
</code></pre>
<p>The reason why nor... | <p>npocmaka correctly diagnosed the problem that the IF command gets its own special parsing phase, and token delimiters within the variable expansion are causing problems.</p> <p>Substitution also causes a problem:</p> <pre><code>:: This fails if !test:String=!==test echo Success </code></pre> <p>The reason why nor... | 2631, 2773, 7002, 19675 | batch-file, cmd, delayedvariableexpansion, if-statement | <h1>Why can I not get a substring of a delayed expansion variable in an if statement?</h1>
<p>Why does string-manipulation work inline in an if statement without using delayed expansion variables - but fails otherwise. For example:</p>
<pre><code>set test=testString
if %test:~0,4%==test echo Success
</code></pre>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,562 | cmd | # Why can I not get a substring of a delayed expansion variable in an if statement?
Why does string-manipulation work inline in an if statement without using delayed expansion variables - but fails otherwise. For example:
```
set test=testString
if %test:~0,4%==test echo Success
```
This works correctly; returning `... | npocmaka correctly diagnosed the problem that the IF command gets its own special parsing phase, and token delimiters within the variable expansion are causing problems.
Substitution also causes a problem:
```
:: This fails
if !test:String=!==test echo Success
```
The reason why normal expansion works is because tha... |
20346456 | How to establish socket connection using the command line | 14 | 2013-12-03 08:45:41 | <p>How can I establish my socket connection using the Windows command line?</p>
<p>For example, my socket IP and port num is <code>192.168.1.180:9760</code></p>
<p>I just want to send commands to that IP from the command line.</p>
| 67,205 | 2,901,888 | 2016-08-26 10:26:31 | 20,346,608 | 11 | 2013-12-03 08:53:50 | 2,836,621 | 2013-12-03 09:42:13 | https://stackoverflow.com/q/20346456 | https://stackoverflow.com/a/20346608 | <p>You can use "netcat", or "nc" as it is sometimes called.</p>
<p>So if the server is using UDP on port 9760, you can use:</p>
<pre><code>nc -u 192.168.1.180 9760
</code></pre>
| <p>You can use "netcat", or "nc" as it is sometimes called.</p> <p>So if the server is using UDP on port 9760, you can use:</p> <pre><code>nc -u 192.168.1.180 9760 </code></pre> | 35, 64, 7002 | batch-file, sockets, windows | <h1>How to establish socket connection using the command line</h1>
<p>How can I establish my socket connection using the Windows command line?</p>
<p>For example, my socket IP and port num is <code>192.168.1.180:9760</code></p>
<p>I just want to send commands to that IP from the command line.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,564 | cmd | # How to establish socket connection using the command line
How can I establish my socket connection using the Windows command line?
For example, my socket IP and port num is `192.168.1.180:9760`
I just want to send commands to that IP from the command line. | You can use "netcat", or "nc" as it is sometimes called.
So if the server is using UDP on port 9760, you can use:
```
nc -u 192.168.1.180 9760
``` |
29930624 | Batch files: If directory exists, do something | 13 | 2015-04-28 21:53:08 | <p>I'm trying to do the following:</p>
<pre><code>IF EXISTS ("C:\Users\user\Desktop\folder1\") {
MOVE "C:\Users\user\Desktop\folder2\" "C:\Users\user\Desktop\folder1\"
RENAME "C:\Users\user\Desktop\folder1\folder2\" "folder3"
} else {
MKDIR "C:\Users\user\Desktop\folder1\"
MOVE "C:\Users\user\Desktop\folder2\" "C:\... | 40,131 | 901,094 | 2016-01-14 12:21:15 | 29,936,489 | 11 | 2015-04-29 07:01:56 | 1,016,274 | 2015-04-30 13:47:31 | https://stackoverflow.com/q/29930624 | https://stackoverflow.com/a/29936489 | <p><code>IF EXIST</code> checks only if a file exists and cannot check folders. Usually, you test like this </p>
<pre><code>IF NOT EXIST "myfolder\NUL" mkdir "myfolder"
</code></pre>
<p>The pseudo device <code>NUL</code> acts like a file and does in fact exist in every folder. Note the spelling. </p>
<p>But I ha... | <p><code>IF EXIST</code> checks only if a file exists and cannot check folders. Usually, you test like this </p> <pre><code>IF NOT EXIST "myfolder\NUL" mkdir "myfolder" </code></pre> <p>The pseudo device <code>NUL</code> acts like a file and does in fact exist in every folder. Note the spelling. </p> <p>But I ha... | 2773, 7002, 34595 | batch-file, if-statement, windows-7 | <h1>Batch files: If directory exists, do something</h1>
<p>I'm trying to do the following:</p>
<pre><code>IF EXISTS ("C:\Users\user\Desktop\folder1\") {
MOVE "C:\Users\user\Desktop\folder2\" "C:\Users\user\Desktop\folder1\"
RENAME "C:\Users\user\Desktop\folder1\folder2\" "folder3"
} else {
MKDIR "C:\Users\user\Desk... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,565 | cmd | # Batch files: If directory exists, do something
I'm trying to do the following:
```
IF EXISTS ("C:\Users\user\Desktop\folder1\") {
MOVE "C:\Users\user\Desktop\folder2\" "C:\Users\user\Desktop\folder1\"
RENAME "C:\Users\user\Desktop\folder1\folder2\" "folder3"
} else {
MKDIR "C:\Users\user\Desktop\folder1\"
MOVE "... | `IF EXIST` checks only if a file exists and cannot check folders. Usually, you test like this
```
IF NOT EXIST "myfolder\NUL" mkdir "myfolder"
```
The pseudo device `NUL` acts like a file and does in fact exist in every folder. Note the spelling.
But I have seen that test fail in batchfiles, for unknown reasons. So ... |
9709474 | Sendkeys from command prompt | 13 | 2012-03-14 20:07:20 | <p>Is there a way to use sendkeys (or something equivalent) <strong>from</strong> (not to) the command prompt?</p>
| 59,077 | 389,823 | 2024-11-10 08:08:33 | 9,710,430 | 11 | 2012-03-14 21:18:17 | 25,122 | 2023-05-04 01:57:08 | https://stackoverflow.com/q/9709474 | https://stackoverflow.com/a/9710430 | <p>You can use vbscript. For example, this script will mute the speakers.</p>
<pre><code>set shell = CreateObject("WScript.Shell")
shell.run"Sndvol"
WScript.Sleep 1500
shell.SendKeys"{TAB}"
shell.SendKeys" "
shell.SendKeys"%{F4}"
</code></pre>
<p>You launch it from the ... | <p>You can use vbscript. For example, this script will mute the speakers.</p> <pre><code>set shell = CreateObject("WScript.Shell") shell.run"Sndvol" WScript.Sleep 1500 shell.SendKeys"{TAB}" shell.SendKeys" " shell.SendKeys"%{F4}" </code></pre> <p>You launch it from the ... | 2631, 17846 | cmd, sendkeys | <h1>Sendkeys from command prompt</h1>
<p>Is there a way to use sendkeys (or something equivalent) <strong>from</strong> (not to) the command prompt?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,566 | cmd | # Sendkeys from command prompt
Is there a way to use sendkeys (or something equivalent) **from** (not to) the command prompt? | You can use vbscript. For example, this script will mute the speakers.
```
set shell = CreateObject("WScript.Shell")
shell.run"Sndvol"
WScript.Sleep 1500
shell.SendKeys"{TAB}"
shell.SendKeys" "
shell.SendKeys"%{F4}"
```
You launch it from the console with
```
cscript mute.vbs
``` |
30834730 | How to print iterations per second? | 12 | 2015-06-14 21:27:15 | <p>I have a small Python script which sends POST requests to a server and gets their response.</p>
<p>It iterates 10000 times, and I managed to print the current progress in command prompt using:</p>
<pre><code>code=current_requestnumber
print('{0}/{1}'.format(str(code),"10000"),end="\r")
</code></pre>
<p>at the end... | 12,592 | 2,879,551 | 2021-08-03 15:39:21 | 30,834,802 | 11 | 2015-06-14 21:34:52 | 1,576,602 | 2015-06-14 21:43:26 | https://stackoverflow.com/q/30834730 | https://stackoverflow.com/a/30834802 | <p>You can get a total average number of events per second like this:</p>
<pre><code>#!/usr/bin/env python3
import time
import datetime as dt
start_time = dt.datetime.today().timestamp()
i = 0
while(True):
time.sleep(0.1)
time_diff = dt.datetime.today().timestamp() - start_time
i += 1
print(i / time_... | <p>You can get a total average number of events per second like this:</p> <pre><code>#!/usr/bin/env python3 import time import datetime as dt start_time = dt.datetime.today().timestamp() i = 0 while(True): time.sleep(0.1) time_diff = dt.datetime.today().timestamp() - start_time i += 1 print(i / time_... | 16, 598, 2314, 2631, 7060 | cmd, loops, performance, progress, python | <h1>How to print iterations per second?</h1>
<p>I have a small Python script which sends POST requests to a server and gets their response.</p>
<p>It iterates 10000 times, and I managed to print the current progress in command prompt using:</p>
<pre><code>code=current_requestnumber
print('{0}/{1}'.format(str(code),"1... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,567 | cmd | # How to print iterations per second?
I have a small Python script which sends POST requests to a server and gets their response.
It iterates 10000 times, and I managed to print the current progress in command prompt using:
```
code=current_requestnumber
print('{0}/{1}'.format(str(code),"10000"),end="\r")
```
at th... | You can get a total average number of events per second like this:
```
#!/usr/bin/env python3
import time
import datetime as dt
start_time = dt.datetime.today().timestamp()
i = 0
while(True):
time.sleep(0.1)
time_diff = dt.datetime.today().timestamp() - start_time
i += 1
print(i / time_diff)
```
Whi... |
18488946 | Running a php script with a .bat file | 12 | 2013-08-28 13:11:42 | <p>I need to run a php script at midnight every night on my server. On a linux system I'd set up a cron job, but I'm stuck with a windows system.</p>
<p>I know I have to set up a task using the windows task scheduler, and that the task will need to run a .bat file which in turn will run the php file, but I'm stuck try... | 57,532 | 1,773,648 | 2018-06-16 00:35:44 | 18,489,191 | 11 | 2013-08-28 13:21:06 | 50,079 | 2013-08-28 13:21:06 | https://stackoverflow.com/q/18488946 | https://stackoverflow.com/a/18489191 | <p>The <code>START</code> command optionally accepts a title for the created window as its first argument; in this case, it thinks that <code>C:\Program Files (x86)\PHP\v5.3\php.exe</code> is the title to display and <code>-f</code> (the second argument) is the executable you want to run.</p>
<p>You can therefore fix ... | <p>The <code>START</code> command optionally accepts a title for the created window as its first argument; in this case, it thinks that <code>C:\Program Files (x86)\PHP\v5.3\php.exe</code> is the title to display and <code>-f</code> (the second argument) is the executable you want to run.</p> <p>You can therefore fix ... | 5, 64, 7002 | batch-file, php, windows | <h1>Running a php script with a .bat file</h1>
<p>I need to run a php script at midnight every night on my server. On a linux system I'd set up a cron job, but I'm stuck with a windows system.</p>
<p>I know I have to set up a task using the windows task scheduler, and that the task will need to run a .bat file which i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,568 | cmd | # Running a php script with a .bat file
I need to run a php script at midnight every night on my server. On a linux system I'd set up a cron job, but I'm stuck with a windows system.
I know I have to set up a task using the windows task scheduler, and that the task will need to run a .bat file which in turn will run ... | The `START` command optionally accepts a title for the created window as its first argument; in this case, it thinks that `C:\Program Files (x86)\PHP\v5.3\php.exe` is the title to display and `-f` (the second argument) is the executable you want to run.
You can therefore fix this by providing a placeholder title, e.g.... |
15260847 | Using drag and drop from another directory onto a batch file does not work | 12 | 2013-03-07 00:23:07 | <p>I have a folder structure that looks like this:</p>
<pre><code>project
bin
my_program.exe
misc_stuff.exe
DROP_OVER_ME.bat
input_file.txt
</code></pre>
<p>Basically, I want to be able to drag and drop the input file on top of the <code>DROP_OVER_ME.bat</code> batch file and have it pass ... | 12,505 | 646,543 | 2013-03-07 02:56:42 | 15,261,469 | 11 | 2013-03-07 01:30:11 | 1,683,264 | 2013-03-07 02:56:42 | https://stackoverflow.com/q/15260847 | https://stackoverflow.com/a/15261469 | <p>Sounds like the batch script is basing the current working directory as the directory you're dragging <em>from</em>, and not the directory containing the script. (You can test this by adding an <code>echo %cd% && pause</code> to your script if you wish.) Try modifying your script as follows to remove any a... | <p>Sounds like the batch script is basing the current working directory as the directory you're dragging <em>from</em>, and not the directory containing the script. (You can test this by adding an <code>echo %cd% && pause</code> to your script if you wish.) Try modifying your script as follows to remove any a... | 64, 7002 | batch-file, windows | <h1>Using drag and drop from another directory onto a batch file does not work</h1>
<p>I have a folder structure that looks like this:</p>
<pre><code>project
bin
my_program.exe
misc_stuff.exe
DROP_OVER_ME.bat
input_file.txt
</code></pre>
<p>Basically, I want to be able to drag and drop the... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,569 | cmd | # Using drag and drop from another directory onto a batch file does not work
I have a folder structure that looks like this:
```
project
bin
my_program.exe
misc_stuff.exe
DROP_OVER_ME.bat
input_file.txt
```
Basically, I want to be able to drag and drop the input file on top of the `DROP_O... | Sounds like the batch script is basing the current working directory as the directory you're dragging *from*, and not the directory containing the script. (You can test this by adding an `echo %cd% && pause` to your script if you wish.) Try modifying your script as follows to remove any ambiguity about file paths:
```... |
11428692 | Batch file to delete first 3 lines of a text file | 12 | 2012-07-11 08:39:35 | <p>As the title states I need a batch file to delete the FIRST 3 lines of a text file.</p>
<p>for example:</p>
<pre><code>A
B
C
D
E
F
G
</code></pre>
<p>in this example I need A,B and C deleted along with the line</p>
| 68,015 | 1,480,081 | 2016-12-20 14:32:47 | 11,428,764 | 11 | 2012-07-11 08:43:57 | 799,586 | 2012-07-11 13:13:36 | https://stackoverflow.com/q/11428692 | https://stackoverflow.com/a/11428764 | <p>This should do it</p>
<pre><code>for /f "skip=3 delims=*" %%a in (C:\file.txt) do (
echo %%a >>C:\newfile.txt
)
xcopy C:\newfile.txt C:\file.txt /y
del C:\newfile.txt /f /q
</code></pre>
<p>That will re-create the file with the first 3 lines removed.</p>
<p>To keep the user updated you could integrate m... | <p>This should do it</p> <pre><code>for /f "skip=3 delims=*" %%a in (C:\file.txt) do ( echo %%a >>C:\newfile.txt ) xcopy C:\newfile.txt C:\file.txt /y del C:\newfile.txt /f /q </code></pre> <p>That will re-create the file with the first 3 lines removed.</p> <p>To keep the user updated you could integrate m... | 1469, 5310, 6366, 7002 | batch-file, file, lines, text | <h1>Batch file to delete first 3 lines of a text file</h1>
<p>As the title states I need a batch file to delete the FIRST 3 lines of a text file.</p>
<p>for example:</p>
<pre><code>A
B
C
D
E
F
G
</code></pre>
<p>in this example I need A,B and C deleted along with the line</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,571 | cmd | # Batch file to delete first 3 lines of a text file
As the title states I need a batch file to delete the FIRST 3 lines of a text file.
for example:
```
A
B
C
D
E
F
G
```
in this example I need A,B and C deleted along with the line | This should do it
```
for /f "skip=3 delims=*" %%a in (C:\file.txt) do (
echo %%a >>C:\newfile.txt
)
xcopy C:\newfile.txt C:\file.txt /y
del C:\newfile.txt /f /q
```
That will re-create the file with the first 3 lines removed.
To keep the user updated you could integrate messages in the batch file in vbscript st... |
9250567 | Batch file to execute all files in a folder | 12 | 2012-02-12 16:47:09 | <p>I need a batch files the launches all files in a given folder (in this case it is c:\macros\day).</p>
<p>I've tried the following, but it doesn't seem to do anything.</p>
<pre><code>for /f %i in ('C:\macros\Day /b') DO command %i
</code></pre>
| 38,476 | 1,000,276 | 2015-11-17 08:02:56 | 9,250,637 | 11 | 2012-02-12 16:55:30 | 29,157 | 2014-01-21 23:25:16 | https://stackoverflow.com/q/9250567 | https://stackoverflow.com/a/9250637 | <p>This works from my command line:</p>
<pre><code>for /F "usebackq" %%i in (`dir /b C:\macros\Day\`) DO %%i
</code></pre>
<p>as does this:</p>
<pre><code>for %%i in (C:\macros\Day\*) do %%i
</code></pre>
| <p>This works from my command line:</p> <pre><code>for /F "usebackq" %%i in (`dir /b C:\macros\Day\`) DO %%i </code></pre> <p>as does this:</p> <pre><code>for %%i in (C:\macros\Day\*) do %%i </code></pre> | 5370, 7002 | batch-file, dos | <h1>Batch file to execute all files in a folder</h1>
<p>I need a batch files the launches all files in a given folder (in this case it is c:\macros\day).</p>
<p>I've tried the following, but it doesn't seem to do anything.</p>
<pre><code>for /f %i in ('C:\macros\Day /b') DO command %i
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,573 | cmd | # Batch file to execute all files in a folder
I need a batch files the launches all files in a given folder (in this case it is c:\macros\day).
I've tried the following, but it doesn't seem to do anything.
```
for /f %i in ('C:\macros\Day /b') DO command %i
``` | This works from my command line:
```
for /F "usebackq" %%i in (`dir /b C:\macros\Day\`) DO %%i
```
as does this:
```
for %%i in (C:\macros\Day\*) do %%i
``` |
638301 | Discover from a batch file where is Java installed? | 12 | 2009-03-12 11:57:32 | <p>I want to set the JAVA_HOME variable from a batch script</p>
| 21,253 | 63,051 | 2011-10-20 01:42:10 | 639,293 | 11 | 2009-03-12 15:59:37 | 7,903 | 2009-03-12 15:59:37 | https://stackoverflow.com/q/638301 | https://stackoverflow.com/a/639293 | <p>This snippet will search the current PATH for java.exe, and print out where it was found:</p>
<pre><code>for /f %%j in ("java.exe") do @echo.%%~dp$PATH:j
</code></pre>
<p>On my system this gives me</p>
<blockquote>
<p>C:\WINDOWS\system32\</p>
</blockquote>
<p>Using this you can set JAVA_HOME as follows:</p>
<... | <p>This snippet will search the current PATH for java.exe, and print out where it was found:</p> <pre><code>for /f %%j in ("java.exe") do @echo.%%~dp$PATH:j </code></pre> <p>On my system this gives me</p> <blockquote> <p>C:\WINDOWS\system32\</p> </blockquote> <p>Using this you can set JAVA_HOME as follows:</p> <... | 17, 64, 7002, 26220 | batch-file, java, java-home, windows | <h1>Discover from a batch file where is Java installed?</h1>
<p>I want to set the JAVA_HOME variable from a batch script</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,574 | cmd | # Discover from a batch file where is Java installed?
I want to set the JAVA_HOME variable from a batch script | This snippet will search the current PATH for java.exe, and print out where it was found:
```
for /f %%j in ("java.exe") do @echo.%%~dp$PATH:j
```
On my system this gives me
> C:\WINDOWS\system32\
Using this you can set JAVA_HOME as follows:
```
@echo off
for /f %%j in ("java.exe") do (
set JAVA_HOME=%%~dp$PA... |
66534762 | Which PyTorch modules are affected by model.eval() and model.train()? | 11 | 2021-03-08 17:53:37 | <p>The <code>model.eval()</code> method modifies certain modules (layers) which are required to behave differently during training and inference. Some examples are listed in <a href="https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.eval" rel="noreferrer">the docs</a>:</p>
<blockquote>
<p>T... | 7,193 | 9,067,615 | 2021-06-08 21:20:46 | 66,614,722 | 11 | 2021-03-13 14:38:52 | 10,886,420 | 2021-06-08 21:20:46 | https://stackoverflow.com/q/66534762 | https://stackoverflow.com/a/66614722 | <p>In addition to info provided by <a href="https://stackoverflow.com/a/66544446/10886420">@iacob</a>:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Base class</th>
<th>Module</th>
<th>Criteria</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="https://pytorch.org/docs/stable/generated/torch.n... | <p>In addition to info provided by <a href="https://stackoverflow.com/a/66544446/10886420">@iacob</a>:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Base class</th> <th>Module</th> <th>Criteria</th> </tr> </thead> <tbody> <tr> <td><a href="https://pytorch.org/docs/stable/generated/torch.n... | 16, 5990, 124253, 124994, 132077 | batch-normalization, dropout, machine-learning, python, pytorch | <h1>Which PyTorch modules are affected by model.eval() and model.train()?</h1>
<p>The <code>model.eval()</code> method modifies certain modules (layers) which are required to behave differently during training and inference. Some examples are listed in <a href="https://pytorch.org/docs/stable/generated/torch.nn.Module.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,575 | cmd | # Which PyTorch modules are affected by model.eval() and model.train()?
The `model.eval()` method modifies certain modules (layers) which are required to behave differently during training and inference. Some examples are listed in [the docs](https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Modu... | In addition to info provided by [@iacob](https://stackoverflow.com/a/66544446/10886420):
| Base class | Module | Criteria |
| --- | --- | --- |
| [`RNNBase`](https://pytorch.org/docs/stable/generated/torch.nn.RNNBase.html#torch.nn.RNNBase) | RNN LSTM GRU | `dropout > 0` (default: `0`) |
| Transformer layers | Tran... |
22836457 | How to make a batch file to run a hotkey | 11 | 2014-04-03 11:37:29 | <p>Every time I start my Windows I want to execute a hotkey (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>1</kbd>) using a batch file and putting it in startup folder. Is that even possible? Is there a command for that?</p>
| 61,316 | 2,169,756 | 2019-05-02 14:48:42 | 22,838,165 | 11 | 2014-04-03 12:44:28 | 1,487,475 | 2018-02-18 21:59:47 | https://stackoverflow.com/q/22836457 | https://stackoverflow.com/a/22838165 | <p>You can't send keys directly from a batch file, instead you can create a VB script to send the keys and call this script from a .bat file</p>
<p>Put the following code to a VB script, for example sendkeys.vbs (^ is <kbd>Ctrl</kbd> and % is <kbd>Alt</kbd>)</p>
<pre><code>Set WshShell = WScript.CreateObject("WScript... | <p>You can't send keys directly from a batch file, instead you can create a VB script to send the keys and call this script from a .bat file</p> <p>Put the following code to a VB script, for example sendkeys.vbs (^ is <kbd>Ctrl</kbd> and % is <kbd>Alt</kbd>)</p> <pre><code>Set WshShell = WScript.CreateObject("WScript... | 2838, 7002 | autohotkey, batch-file | <h1>How to make a batch file to run a hotkey</h1>
<p>Every time I start my Windows I want to execute a hotkey (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>1</kbd>) using a batch file and putting it in startup folder. Is that even possible? Is there a command for that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,576 | cmd | # How to make a batch file to run a hotkey
Every time I start my Windows I want to execute a hotkey (`Ctrl`+`Alt`+`1`) using a batch file and putting it in startup folder. Is that even possible? Is there a command for that? | You can't send keys directly from a batch file, instead you can create a VB script to send the keys and call this script from a .bat file
Put the following code to a VB script, for example sendkeys.vbs (^ is `Ctrl` and % is `Alt`)
```
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "^%1"
```
P... |
20261639 | How do you wait on a Task Scheduler task to finish in a batch file or C#? | 11 | 2013-11-28 09:01:01 | <p>I am trying to write a batch file that does two things:</p>
<ol>
<li>First it launches an installer (install.exe) which installs a program (program.exe).</li>
<li>Second it launches an instance of the installed program (program.exe). This must be executed after the installation completes.</li>
</ol>
<p>This would ... | 19,882 | 3,044,940 | 2020-07-25 21:21:21 | 20,267,245 | 11 | 2013-11-28 13:16:07 | 2,861,476 | 2013-11-28 13:16:07 | https://stackoverflow.com/q/20261639 | https://stackoverflow.com/a/20267245 | <p>From batch file, query the task status, and if it is running, keep querying</p>
<pre><code>:loop
for /f "tokens=2 delims=: " %%f in ('schtasks /query /tn yourTaskName /fo list ^| find "Status:"' ) do (
if "%%f"=="Running" (
ping -n 6 localhost >nul 2>nul
goto loop
)
)
</code></pre>
| <p>From batch file, query the task status, and if it is running, keep querying</p> <pre><code>:loop for /f "tokens=2 delims=: " %%f in ('schtasks /query /tn yourTaskName /fo list ^| find "Status:"' ) do ( if "%%f"=="Running" ( ping -n 6 localhost >nul 2>nul goto loop ) ) </code></pre> | 9, 64, 7002, 9299, 14158 | azure, batch-file, c#, scheduled-tasks, windows | <h1>How do you wait on a Task Scheduler task to finish in a batch file or C#?</h1>
<p>I am trying to write a batch file that does two things:</p>
<ol>
<li>First it launches an installer (install.exe) which installs a program (program.exe).</li>
<li>Second it launches an instance of the installed program (program.exe).... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,577 | cmd | # How do you wait on a Task Scheduler task to finish in a batch file or C#?
I am trying to write a batch file that does two things:
1. First it launches an installer (install.exe) which installs a program (program.exe).
2. Second it launches an instance of the installed program (program.exe). This must be executed af... | From batch file, query the task status, and if it is running, keep querying
```
:loop
for /f "tokens=2 delims=: " %%f in ('schtasks /query /tn yourTaskName /fo list ^| find "Status:"' ) do (
if "%%f"=="Running" (
ping -n 6 localhost >nul 2>nul
goto loop
)
)
``` |
19495293 | Combine For /F with WMIC + WHERE clause + AND clause | 11 | 2013-10-21 13:01:40 | <p>How should this WMIC command be written when included in a <code>FOR</code> command in a script?</p>
<pre><code>wmic service where (name="themes" and state="running") get
</code></pre>
<p>The code below does not work:</p>
<pre><code>For /F %%a in (
'wmic service where ^("name='themes'" and "state='running'"^)... | 15,872 | 1,248,295 | 2018-08-22 21:13:59 | 19,495,581 | 11 | 2013-10-21 13:15:24 | 388,389 | 2013-10-21 13:56:07 | https://stackoverflow.com/q/19495293 | https://stackoverflow.com/a/19495581 | <pre><code>@echo off
For /F "usebackq delims=" %%a in (`wmic service where 'name^="themes" and state^="running"' get`) do (
echo %%a
)
</code></pre>
<p>this one works for me.I've used <code>usebackq</code> option to have no problems with <code>'</code> and alternative wmic syntax - <code>'</code> instead of brack... | <pre><code>@echo off For /F "usebackq delims=" %%a in (`wmic service where 'name^="themes" and state^="running"' get`) do ( echo %%a ) </code></pre> <p>this one works for me.I've used <code>usebackq</code> option to have no problems with <code>'</code> and alternative wmic syntax - <code>'</code> instead of brack... | 367, 2531, 7002, 61774 | batch-file, for-loop, syntax, wmic | <h1>Combine For /F with WMIC + WHERE clause + AND clause</h1>
<p>How should this WMIC command be written when included in a <code>FOR</code> command in a script?</p>
<pre><code>wmic service where (name="themes" and state="running") get
</code></pre>
<p>The code below does not work:</p>
<pre><code>For /F %%a in (
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,578 | cmd | # Combine For /F with WMIC + WHERE clause + AND clause
How should this WMIC command be written when included in a `FOR` command in a script?
```
wmic service where (name="themes" and state="running") get
```
The code below does not work:
```
For /F %%a in (
'wmic service where ^("name='themes'" and "state='runn... | ```
@echo off
For /F "usebackq delims=" %%a in (`wmic service where 'name^="themes" and state^="running"' get`) do (
echo %%a
)
```
this one works for me.I've used `usebackq` option to have no problems with `'` and alternative wmic syntax - `'` instead of brackets. |
5124243 | Windows batch script: Perform a command if two files are the same! | 11 | 2011-02-26 00:41:12 | <p>I would have thought this was going to be a very simple task but I have been struggling with it for a couple of days now, and slightly frustrated! I am not very familiar with Windows batch scripts so please if you know the answer, keep it as simple as possible :)</p>
<p>Basically, I have a Windows Shutdown script (... | 18,169 | 635,069 | 2017-05-18 21:13:22 | 5,124,287 | 11 | 2011-02-26 00:48:04 | 34,065 | 2011-02-26 00:48:04 | https://stackoverflow.com/q/5124243 | https://stackoverflow.com/a/5124287 | <p>This script should work:</p>
<pre><code>fc /b file1 file2 > nul
if errorlevel 1 goto files_differ
[files are the same, do something here]
:files_differ
[files are not the same, do something here]
</code></pre>
| <p>This script should work:</p> <pre><code>fc /b file1 file2 > nul if errorlevel 1 goto files_differ [files are the same, do something here] :files_differ [files are not the same, do something here] </code></pre> | 64, 2936, 5310, 7002 | batch-file, compare, file, windows | <h1>Windows batch script: Perform a command if two files are the same!</h1>
<p>I would have thought this was going to be a very simple task but I have been struggling with it for a couple of days now, and slightly frustrated! I am not very familiar with Windows batch scripts so please if you know the answer, keep it as... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,579 | cmd | # Windows batch script: Perform a command if two files are the same!
I would have thought this was going to be a very simple task but I have been struggling with it for a couple of days now, and slightly frustrated! I am not very familiar with Windows batch scripts so please if you know the answer, keep it as simple a... | This script should work:
```
fc /b file1 file2 > nul
if errorlevel 1 goto files_differ
[files are the same, do something here]
:files_differ
[files are not the same, do something here]
``` |
2438864 | The system cannot find the file specified when running CMD.exe from C# | 11 | 2010-03-13 15:27:41 | <p>I'm getting the error message when running the following code from a C# console program.</p>
<blockquote>
<p>"The system cannot find the file
specified"</p>
</blockquote>
<p>Here is the code:</p>
<blockquote>
<p>System.Diagnostics.Process.Start("C:\Windows\System32\cmd.exe
/c");</p>
</blockquote>
<p>Stra... | 25,822 | null | 2012-08-20 13:56:17 | 2,438,882 | 11 | 2010-03-13 15:33:22 | 91,687 | 2010-03-13 15:33:22 | https://stackoverflow.com/q/2438864 | https://stackoverflow.com/a/2438882 | <p><code>Process.Start</code> takes a filename as an argument. Pass the argument as the second parameter:</p>
<pre><code>System.Diagnostics.Process.Start(@"C:\Windows\System32\cmd.exe", "/c");
</code></pre>
| <p><code>Process.Start</code> takes a filename as an argument. Pass the argument as the second parameter:</p> <pre><code>System.Diagnostics.Process.Start(@"C:\Windows\System32\cmd.exe", "/c"); </code></pre> | 9, 2631 | c#, cmd | <h1>The system cannot find the file specified when running CMD.exe from C#</h1>
<p>I'm getting the error message when running the following code from a C# console program.</p>
<blockquote>
<p>"The system cannot find the file
specified"</p>
</blockquote>
<p>Here is the code:</p>
<blockquote>
<p>System.Diagnosti... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,580 | cmd | # The system cannot find the file specified when running CMD.exe from C#
I'm getting the error message when running the following code from a C# console program.
> "The system cannot find the file
> specified"
Here is the code:
> System.Diagnostics.Process.Start("C:\Windows\System32\cmd.exe
> /c");
Strangely when ... | `Process.Start` takes a filename as an argument. Pass the argument as the second parameter:
```
System.Diagnostics.Process.Start(@"C:\Windows\System32\cmd.exe", "/c");
``` |
1687233 | DOS batch: SET variable and ECHO it within (...) block | 11 | 2009-11-06 12:19:48 | <p>I had a problem with <code>set</code> not working in a batch file; it took a while to distil the problem; at first I thought it was to do with subroutine calls...</p>
<p>The script</p>
<pre><code>@echo off
setlocal
set a=aaa
echo a = "%a%"
(
set b=bbb
echo b = "%b%"
)
</code></pre>
<p>produces the output</p>
<pr... | 11,172 | 202,130 | 2018-07-06 09:30:18 | 1,687,481 | 11 | 2009-11-06 13:04:16 | 174,447 | 2009-11-06 13:04:16 | https://stackoverflow.com/q/1687233 | https://stackoverflow.com/a/1687481 | <p>User delayed expansion and ! instead of % </p>
<pre><code>@echo off
setlocal enableextensions enabledelayedexpansion
set a=aaa
echo a = "%a%"
(
set b=bbb
echo b = "!b!"
)
</code></pre>
| <p>User delayed expansion and ! instead of % </p> <pre><code>@echo off setlocal enableextensions enabledelayedexpansion set a=aaa echo a = "%a%" ( set b=bbb echo b = "!b!" ) </code></pre> | 2631, 7002 | batch-file, cmd | <h1>DOS batch: SET variable and ECHO it within (...) block</h1>
<p>I had a problem with <code>set</code> not working in a batch file; it took a while to distil the problem; at first I thought it was to do with subroutine calls...</p>
<p>The script</p>
<pre><code>@echo off
setlocal
set a=aaa
echo a = "%a%"
(
set b=bbb... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,581 | cmd | # DOS batch: SET variable and ECHO it within (...) block
I had a problem with `set` not working in a batch file; it took a while to distil the problem; at first I thought it was to do with subroutine calls...
The script
```
@echo off
setlocal
set a=aaa
echo a = "%a%"
(
set b=bbb
echo b = "%b%"
)
```
produces the ou... | User delayed expansion and ! instead of %
```
@echo off
setlocal enableextensions enabledelayedexpansion
set a=aaa
echo a = "%a%"
(
set b=bbb
echo b = "!b!"
)
``` |
17926093 | H2 SQL Grammar Exception | 10 | 2013-07-29 14:00:59 | <p>I am trying to import a sql script for H2. This script is provided by spring-batch and it's used to store the jobs metadata. When I execute this script directly in the H2 console, I have no syntax errors, but I referenced the same script in Hibernate/JPA to be imported at the initialization phase, I got this except... | 15,354 | 314,862 | 2013-07-29 15:11:01 | 17,926,583 | 11 | 2013-07-29 14:24:56 | 280,244 | 2013-07-29 14:32:09 | https://stackoverflow.com/q/17926093 | https://stackoverflow.com/a/17926583 | <p>Try to write each of your create statements in one line.</p>
<p>The statement delimiter in import.sql is a newline. If you want to change it, then you need to use Hibernate > 4.1. There you can Implement a <code>MultipleLinesSqlCommandExtractor</code> and specify it by <code>hibernate.hbm2ddl.import_files_sql_extra... | <p>Try to write each of your create statements in one line.</p> <p>The statement delimiter in import.sql is a newline. If you want to change it, then you need to use Hibernate > 4.1. There you can Implement a <code>MultipleLinesSqlCommandExtractor</code> and specify it by <code>hibernate.hbm2ddl.import_files_sql_extra... | 1211, 2620, 9970, 41895 | h2, hibernate, spring, spring-batch | <h1>H2 SQL Grammar Exception</h1>
<p>I am trying to import a sql script for H2. This script is provided by spring-batch and it's used to store the jobs metadata. When I execute this script directly in the H2 console, I have no syntax errors, but I referenced the same script in Hibernate/JPA to be imported at the initi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,583 | cmd | # H2 SQL Grammar Exception
I am trying to import a sql script for H2. This script is provided by spring-batch and it's used to store the jobs metadata. When I execute this script directly in the H2 console, I have no syntax errors, but I referenced the same script in Hibernate/JPA to be imported at the initialization ... | Try to write each of your create statements in one line.
The statement delimiter in import.sql is a newline. If you want to change it, then you need to use Hibernate > 4.1. There you can Implement a `MultipleLinesSqlCommandExtractor` and specify it by `hibernate.hbm2ddl.import_files_sql_extractor`
- @See <http://docs... |
15685816 | How can I remove empty lines from wmic output? | 10 | 2013-03-28 15:27:14 | <p>This is my string to obtain the position of TeamViewer (any version) service executable:</p>
<pre><code>for /f "skip=1 delims=" %A in ('wmic path win32_service where "name like 'TeamViewer%'" get pathname') do set POSITION=%A
</code></pre>
<p>The problem is caused by <code>wmic</code> because it includes an empty ... | 11,090 | 2,220,346 | 2013-06-12 15:11:36 | 15,686,239 | 11 | 2013-03-28 15:46:11 | 1,630,171 | 2013-03-28 15:46:11 | https://stackoverflow.com/q/15685816 | https://stackoverflow.com/a/15686239 | <p>Like this:</p>
<pre><code>for /f "skip=1 delims=" %A in (
'wmic path win32_service where "name like 'TeamViewer%'" get pathname ^| findstr /r /v "^$"'
) do set POSITION=%A
</code></pre>
<p>The <code>findstr /r /v "^$"</code> removes empty lines from the output.</p>
| <p>Like this:</p> <pre><code>for /f "skip=1 delims=" %A in ( 'wmic path win32_service where "name like 'TeamViewer%'" get pathname ^| findstr /r /v "^$"' ) do set POSITION=%A </code></pre> <p>The <code>findstr /r /v "^$"</code> removes empty lines from the output.</p> | 64, 2631, 6268, 61774 | cmd, path, windows, wmic | <h1>How can I remove empty lines from wmic output?</h1>
<p>This is my string to obtain the position of TeamViewer (any version) service executable:</p>
<pre><code>for /f "skip=1 delims=" %A in ('wmic path win32_service where "name like 'TeamViewer%'" get pathname') do set POSITION=%A
</code></pre>
<p>The problem is c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,584 | cmd | # How can I remove empty lines from wmic output?
This is my string to obtain the position of TeamViewer (any version) service executable:
```
for /f "skip=1 delims=" %A in ('wmic path win32_service where "name like 'TeamViewer%'" get pathname') do set POSITION=%A
```
The problem is caused by `wmic` because it includ... | Like this:
```
for /f "skip=1 delims=" %A in (
'wmic path win32_service where "name like 'TeamViewer%'" get pathname ^| findstr /r /v "^$"'
) do set POSITION=%A
```
The `findstr /r /v "^$"` removes empty lines from the output. |
6166568 | Hibernate Batch Insert. Would it ever use one insert instead of multiple inserts? | 10 | 2011-05-29 07:53:22 | <p>I've been looking around trying to determine some Hibernate behavior that I'm unsure about. In a scenario where Hibernate batching is properly set up, will it only ever use multiple insert statements when a batch is sent? Is it not possible to use a DB independent multi-insert statement?</p>
<p>I guess I'm trying t... | 7,540 | 366,447 | 2013-01-24 00:17:21 | 6,167,188 | 11 | 2011-05-29 10:29:41 | 571,407 | 2011-05-29 10:29:41 | https://stackoverflow.com/q/6166568 | https://stackoverflow.com/a/6167188 | <p>Hibernate uses multiple insert statements (one per entity to insert), but sends them to the database in batch mode (using <a href="http://download.oracle.com/javase/6/docs/api/java/sql/Statement.html#addBatch%28java.lang.String%29" rel="noreferrer"><code>Statement.addBatch()</code></a> and <a href="http://download.o... | <p>Hibernate uses multiple insert statements (one per entity to insert), but sends them to the database in batch mode (using <a href="http://download.oracle.com/javase/6/docs/api/java/sql/Statement.html#addBatch%28java.lang.String%29" rel="noreferrer"><code>Statement.addBatch()</code></a> and <a href="http://download.o... | 17, 2620, 7002, 165558 | batch-file, hibernate, java, oracle-database | <h1>Hibernate Batch Insert. Would it ever use one insert instead of multiple inserts?</h1>
<p>I've been looking around trying to determine some Hibernate behavior that I'm unsure about. In a scenario where Hibernate batching is properly set up, will it only ever use multiple insert statements when a batch is sent? Is i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,585 | cmd | # Hibernate Batch Insert. Would it ever use one insert instead of multiple inserts?
I've been looking around trying to determine some Hibernate behavior that I'm unsure about. In a scenario where Hibernate batching is properly set up, will it only ever use multiple insert statements when a batch is sent? Is it not pos... | Hibernate uses multiple insert statements (one per entity to insert), but sends them to the database in batch mode (using [`Statement.addBatch()`](http://download.oracle.com/javase/6/docs/api/java/sql/Statement.html#addBatch%28java.lang.String%29) and [`Statement.executeBatch()`](http://download.oracle.com/javase/6/doc... |
5789568 | SQLCMD utility from BAT file - how to return ERRORLEVEL in case of syntax error | 10 | 2011-04-26 11:21:56 | <p>How can I get %ERRORLEVEL% from SQLCMD utility when some of .sql files contains syntax error? These files create stored procedures. They don't invoke "raiseerror", but they can conatin syntax error and I need to terminate the process.
But it always returns %ERRORLEVEL% as 0.
I tried use -b, -V and -m (and their comb... | 13,093 | 668,183 | 2014-06-26 08:01:53 | 5,792,211 | 11 | 2011-04-26 14:54:46 | 653,295 | 2011-04-26 15:01:50 | https://stackoverflow.com/q/5789568 | https://stackoverflow.com/a/5792211 | <p>You do need the <code>-b</code> switch but together with <code>enabledelayedexpansion</code>, that way you can use <code>!errorlevel!</code> inside the loop and get the expected results.</p>
<p>Put <code>setlocal enabledelayedexpansion</code> anywhere before you execute <code>sqlcmd</code>, probably best at the beg... | <p>You do need the <code>-b</code> switch but together with <code>enabledelayedexpansion</code>, that way you can use <code>!errorlevel!</code> inside the loop and get the expected results.</p> <p>Put <code>setlocal enabledelayedexpansion</code> anywhere before you execute <code>sqlcmd</code>, probably best at the beg... | 22, 7002, 7445, 9993 | batch-file, sql, sqlcmd, syntax-error | <h1>SQLCMD utility from BAT file - how to return ERRORLEVEL in case of syntax error</h1>
<p>How can I get %ERRORLEVEL% from SQLCMD utility when some of .sql files contains syntax error? These files create stored procedures. They don't invoke "raiseerror", but they can conatin syntax error and I need to terminate the pr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,586 | cmd | # SQLCMD utility from BAT file - how to return ERRORLEVEL in case of syntax error
How can I get %ERRORLEVEL% from SQLCMD utility when some of .sql files contains syntax error? These files create stored procedures. They don't invoke "raiseerror", but they can conatin syntax error and I need to terminate the process.
Bu... | You do need the `-b` switch but together with `enabledelayedexpansion`, that way you can use `!errorlevel!` inside the loop and get the expected results.
Put `setlocal enabledelayedexpansion` anywhere before you execute `sqlcmd`, probably best at the beginning of the batch or just before the loop. Also note the use of... |
9556676 | Batch file: How to replace "=" (equal signs) and a string variable? | 9 | 2012-03-04 16:35:11 | <p>Besides SED, how can an equal sign be replaced?
And how can I use a string variable in string replacement?</p>
<p>Consider this example:</p>
<pre><code>For /F "tokens=*" %%B IN (test.txt) DO (
SETLOCAL ENABLEDELAYEDEXPANSION
SET t=is
SET old=%%B
SET new=!old:t=!
ECHO !new!
ENDLOCAL
)
:: SET new... | 28,457 | 900,923 | 2025-11-27 04:24:44 | 51,827,258 | 11 | 2018-08-13 17:01:27 | 6,336,728 | 2024-07-28 10:12:50 | https://stackoverflow.com/q/9556676 | https://stackoverflow.com/a/51827258 | <p>I just created a simple solution for this myself, maybe it helps someone.</p>
<p>The disadvantage (or advantage, depends on what you want to do) is that multiple equal signs one after another get handled like one single equal sign. (example: "str==ing" gives the same output as "str=ing")</p>
<pre... | <p>I just created a simple solution for this myself, maybe it helps someone.</p> <p>The disadvantage (or advantage, depends on what you want to do) is that multiple equal signs one after another get handled like one single equal sign. (example: "str==ing" gives the same output as "str=ing")</p> <pre... | 139, 2498, 2631, 7002 | batch-file, cmd, replace, string | <h1>Batch file: How to replace "=" (equal signs) and a string variable?</h1>
<p>Besides SED, how can an equal sign be replaced?
And how can I use a string variable in string replacement?</p>
<p>Consider this example:</p>
<pre><code>For /F "tokens=*" %%B IN (test.txt) DO (
SETLOCAL ENABLEDELAYEDEXPANSION
SET t=i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,587 | cmd | # Batch file: How to replace "=" (equal signs) and a string variable?
Besides SED, how can an equal sign be replaced?
And how can I use a string variable in string replacement?
Consider this example:
```
For /F "tokens=*" %%B IN (test.txt) DO (
SETLOCAL ENABLEDELAYEDEXPANSION
SET t=is
SET old=%%B
SET new... | I just created a simple solution for this myself, maybe it helps someone.
The disadvantage (or advantage, depends on what you want to do) is that multiple equal signs one after another get handled like one single equal sign. (example: "str==ing" gives the same output as "str=ing")
```
@echo off
set "x=this is=an test... |
40109286 | Accessing Azure File Storage from Azure Function | 9 | 2016-10-18 13:12:10 | <p>I'm attempting to retrieve a file out of Azure File Storage to be used by an .exe that is executed within an Azure Function and can't seem to get pass the UNC credentials. </p>
<p>My app gets the UNC file path out of an Azure SQL database and then attempts to navigate to that UNC path (in Azure File Storage) to im... | 23,182 | 1,245,546 | 2016-10-19 02:43:48 | 40,109,398 | 11 | 2016-10-18 13:17:46 | 188,096 | 2016-10-18 13:17:46 | https://stackoverflow.com/q/40109286 | https://stackoverflow.com/a/40109398 | <p>I believe it is not possible to mount an <code>Azure File Service Share</code> in an <code>Azure Function</code> as you don't get access to underlying infrastructure (<a href="https://stackoverflow.com/questions/33545250/how-can-i-use-azure-file-storage-with-web-app-service">same deal as <code>WebApps</code></a>).</... | <p>I believe it is not possible to mount an <code>Azure File Service Share</code> in an <code>Azure Function</code> as you don't get access to underlying infrastructure (<a href="https://stackoverflow.com/questions/33545250/how-can-i-use-azure-file-storage-with-web-app-service">same deal as <code>WebApps</code></a>).</... | 7002, 14158, 115169, 118870 | azure, azure-functions, azure-sql-database, batch-file | <h1>Accessing Azure File Storage from Azure Function</h1>
<p>I'm attempting to retrieve a file out of Azure File Storage to be used by an .exe that is executed within an Azure Function and can't seem to get pass the UNC credentials. </p>
<p>My app gets the UNC file path out of an Azure SQL database and then attempts ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,589 | cmd | # Accessing Azure File Storage from Azure Function
I'm attempting to retrieve a file out of Azure File Storage to be used by an .exe that is executed within an Azure Function and can't seem to get pass the UNC credentials.
My app gets the UNC file path out of an Azure SQL database and then attempts to navigate to tha... | I believe it is not possible to mount an `Azure File Service Share` in an `Azure Function` as you don't get access to underlying infrastructure ([same deal as `WebApps`](https://stackoverflow.com/questions/33545250/how-can-i-use-azure-file-storage-with-web-app-service)).
What you could do is make use of `Azure Storage... |
34041410 | batch preparedstatement with different sql queries | 9 | 2015-12-02 11:18:00 | <p>I found existing questions <a href="https://stackoverflow.com/questions/11366547/preparedstatement-batching-with-different-sql-statements">similar</a> to this one that did not actually have a clear answer to the question.</p>
<p>A normal batch preparedstatement with one sql query would look something like this:</p>... | 11,905 | 4,887,806 | 2015-12-03 00:39:16 | 34,055,831 | 11 | 2015-12-03 00:39:16 | 2,144,390 | 2015-12-03 00:39:16 | https://stackoverflow.com/q/34041410 | https://stackoverflow.com/a/34055831 | <p>For two (2) different SQL queries you will need two (2) different <code>PreparedStatement</code> objects and each one will have its own batch, but you can simply execute each batch when you want to send the queries to the server:</p>
<pre class="lang-java prettyprint-override"><code>try (
PreparedStatement ... | <p>For two (2) different SQL queries you will need two (2) different <code>PreparedStatement</code> objects and each one will have its own batch, but you can simply execute each batch when you want to send the queries to the server:</p> <pre class="lang-java prettyprint-override"><code>try ( PreparedStatement ... | 17, 3314, 5617, 10898, 30645 | batch-processing, java, jdbc, prepared-statement, sql-injection | <h1>batch preparedstatement with different sql queries</h1>
<p>I found existing questions <a href="https://stackoverflow.com/questions/11366547/preparedstatement-batching-with-different-sql-statements">similar</a> to this one that did not actually have a clear answer to the question.</p>
<p>A normal batch preparedstat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,590 | cmd | # batch preparedstatement with different sql queries
I found existing questions [similar](https://stackoverflow.com/questions/11366547/preparedstatement-batching-with-different-sql-statements) to this one that did not actually have a clear answer to the question.
A normal batch preparedstatement with one sql query wo... | For two (2) different SQL queries you will need two (2) different `PreparedStatement` objects and each one will have its own batch, but you can simply execute each batch when you want to send the queries to the server:
```
try (
PreparedStatement thisPs = conn.prepareStatement("INSERT INTO thisTable (thisId, t... |
33218246 | Batch script stops executing after `gulp` process is complete, does not continue executing the rest of the script | 9 | 2015-10-19 15:25:48 | <p>I am attempting to write a simple batch file to build a <code>gulp</code> project and a <code>maven</code> project.</p>
<p>The current file follows:</p>
<pre><code>cd C:\my\file\path
cmd /k gulp maven-deploy-local
cd C:\my\file\path\two\project-pom-parent
cmd /k mvn clean install -Dmaven.test.skip=true
</code></pr... | 2,772 | 3,434,874 | 2015-10-23 13:30:38 | 33,237,122 | 11 | 2015-10-20 12:48:49 | 2,299,431 | 2015-10-20 12:48:49 | https://stackoverflow.com/q/33218246 | https://stackoverflow.com/a/33237122 | <p>This task is specific enough to use this as well:</p>
<pre><code>cd /d "C:\my\file\path"
cmd /c gulp maven-deploy-local
cd /d "C:\my\file\path\two\project-pom-parent"
cmd /k mvn clean install -Dmaven.test.skip=true
</code></pre>
<p>In essence the first <code>cmd /k</code> can be changed to <code>cmd /c</code> so i... | <p>This task is specific enough to use this as well:</p> <pre><code>cd /d "C:\my\file\path" cmd /c gulp maven-deploy-local cd /d "C:\my\file\path\two\project-pom-parent" cmd /k mvn clean install -Dmaven.test.skip=true </code></pre> <p>In essence the first <code>cmd /k</code> can be changed to <code>cmd /c</code> so i... | 5647, 7002, 41127, 46426, 99715 | batch-file, build, gulp, maven, node.js | <h1>Batch script stops executing after `gulp` process is complete, does not continue executing the rest of the script</h1>
<p>I am attempting to write a simple batch file to build a <code>gulp</code> project and a <code>maven</code> project.</p>
<p>The current file follows:</p>
<pre><code>cd C:\my\file\path
cmd /k gu... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,591 | cmd | # Batch script stops executing after `gulp` process is complete, does not continue executing the rest of the script
I am attempting to write a simple batch file to build a `gulp` project and a `maven` project.
The current file follows:
```
cd C:\my\file\path
cmd /k gulp maven-deploy-local
cd C:\my\file\path\two\proj... | This task is specific enough to use this as well:
```
cd /d "C:\my\file\path"
cmd /c gulp maven-deploy-local
cd /d "C:\my\file\path\two\project-pom-parent"
cmd /k mvn clean install -Dmaven.test.skip=true
```
In essence the first `cmd /k` can be changed to `cmd /c` so it executes the command and continues to the last ... |
11761235 | running multiple commands in windows command line | 9 | 2012-08-01 14:16:31 | <p>how can I run multiple commands at once from windows command line?
In *nix environment I can do:</p>
<pre><code>export VAR=foo; echo $VAR
</code></pre>
<p>The closest way I was able to find is this: </p>
<pre><code>set VAR=foo & echo %VAR%
</code></pre>
<p>however when I "echo" the VAR is not set. I need all... | 9,464 | 1,020,908 | 2015-02-10 20:05:24 | 11,767,593 | 11 | 2012-08-01 21:07:09 | 388,389 | 2012-08-01 21:07:09 | https://stackoverflow.com/q/11761235 | https://stackoverflow.com/a/11767593 | <p><code>cmd /c call set VAR=foo & echo %VAR%</code> - this worked ok i.e. set is called with "call set"
.You can set call before each of the commands.</p>
| <p><code>cmd /c call set VAR=foo & echo %VAR%</code> - this worked ok i.e. set is called with "call set" .You can set call before each of the commands.</p> | 64, 2631, 7002 | batch-file, cmd, windows | <h1>running multiple commands in windows command line</h1>
<p>how can I run multiple commands at once from windows command line?
In *nix environment I can do:</p>
<pre><code>export VAR=foo; echo $VAR
</code></pre>
<p>The closest way I was able to find is this: </p>
<pre><code>set VAR=foo & echo %VAR%
</code></pr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,592 | cmd | # running multiple commands in windows command line
how can I run multiple commands at once from windows command line?
In *nix environment I can do:
```
export VAR=foo; echo $VAR
```
The closest way I was able to find is this:
```
set VAR=foo & echo %VAR%
```
however when I "echo" the VAR is not set. I need all co... | `cmd /c call set VAR=foo & echo %VAR%` - this worked ok i.e. set is called with "call set"
.You can set call before each of the commands. |
10173844 | How to check empty value in cmd file? | 9 | 2012-04-16 12:12:49 | <p>I have the command line file below. I need to check for an empty value of a variable. I am not supplying any command line arguments.</p>
<pre><code>@echo off
@set PASSWORD=
@set PORT=9001
@set command=START
if %PASSWORD% NEQ () GOTO MyLabel
:MyLabel
@set command=%command% -p%PASSWORD%
@set command=%command% -i%PO... | 19,818 | 662,143 | 2020-01-02 05:26:20 | 10,174,133 | 11 | 2012-04-16 12:32:24 | 367,273 | 2012-04-16 12:32:24 | https://stackoverflow.com/q/10173844 | https://stackoverflow.com/a/10174133 | <p>The following should do it:</p>
<pre><code>if [%PASSWORD%] NEQ [] GOTO MyLabel
</code></pre>
<p>For more info, see <a href="http://ss64.com/nt/if.html" rel="noreferrer">ss64.com</a>.</p>
| <p>The following should do it:</p> <pre><code>if [%PASSWORD%] NEQ [] GOTO MyLabel </code></pre> <p>For more info, see <a href="http://ss64.com/nt/if.html" rel="noreferrer">ss64.com</a>.</p> | 2631, 7002 | batch-file, cmd | <h1>How to check empty value in cmd file?</h1>
<p>I have the command line file below. I need to check for an empty value of a variable. I am not supplying any command line arguments.</p>
<pre><code>@echo off
@set PASSWORD=
@set PORT=9001
@set command=START
if %PASSWORD% NEQ () GOTO MyLabel
:MyLabel
@set command=%comm... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,593 | cmd | # How to check empty value in cmd file?
I have the command line file below. I need to check for an empty value of a variable. I am not supplying any command line arguments.
```
@echo off
@set PASSWORD=
@set PORT=9001
@set command=START
if %PASSWORD% NEQ () GOTO MyLabel
:MyLabel
@set command=%command% -p%PASSWORD%
@... | The following should do it:
```
if [%PASSWORD%] NEQ [] GOTO MyLabel
```
For more info, see [ss64.com](http://ss64.com/nt/if.html). |
4097041 | Echoing in the same line | 9 | 2010-11-04 13:17:46 | <p>I had a look at the previous questions of your db and I didn't try an answer, but I try.</p>
<p>I would like to write the following lines code:</p>
<pre><code>echo Executing backup....
backup procedure
echo Ok
</code></pre>
<p>but the output should be: </p>
<pre><code>Executing backup... Ok
</code></pre>
<p>Tha... | 19,478 | null | 2017-08-02 04:18:17 | 4,097,156 | 11 | 2010-11-04 13:33:37 | 463,115 | 2012-12-03 20:59:32 | https://stackoverflow.com/q/4097041 | https://stackoverflow.com/a/4097156 | <p>I suppose you are using dos/nt-batch.</p>
<p>It is possible with the set /p command, because set /p doesn't print a CrLf</p>
<pre><code>set /p "=Executing backup...." <nul
echo OK
</code></pre>
<p>Also it's possible to erase the line with a CR character.
It's important to know that whitespace characters at the... | <p>I suppose you are using dos/nt-batch.</p> <p>It is possible with the set /p command, because set /p doesn't print a CrLf</p> <pre><code>set /p "=Executing backup...." <nul echo OK </code></pre> <p>Also it's possible to erase the line with a CR character. It's important to know that whitespace characters at the... | 64, 7002, 13824, 23964 | batch-file, echo, windows, windows-server-2003 | <h1>Echoing in the same line</h1>
<p>I had a look at the previous questions of your db and I didn't try an answer, but I try.</p>
<p>I would like to write the following lines code:</p>
<pre><code>echo Executing backup....
backup procedure
echo Ok
</code></pre>
<p>but the output should be: </p>
<pre><code>Executing ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,594 | cmd | # Echoing in the same line
I had a look at the previous questions of your db and I didn't try an answer, but I try.
I would like to write the following lines code:
```
echo Executing backup....
backup procedure
echo Ok
```
but the output should be:
```
Executing backup... Ok
```
That's possible?! | I suppose you are using dos/nt-batch.
It is possible with the set /p command, because set /p doesn't print a CrLf
```
set /p "=Executing backup...." <nul
echo OK
```
Also it's possible to erase the line with a CR character.
It's important to know that whitespace characters at the front of an set /p are ignored (in V... |
3754798 | IF ELSE problem COMMAND BATCH | 9 | 2010-09-20 19:25:26 | <p>I have problem about IF ELSE in Command Batch script...</p>
<p>In Notepad:<br>
Code:</p>
<pre><code>:CHECKACCOUNT
if /I "%user%"=="insertusername" ( GOTO :ACCOUNT ) ELSE ( GOTO :CHECKPASSACCT )
:CHECKPASSACCT
if /I "%pass%"=="insertpassword" ( GOTO :ACCOUNT ) ELSE ( GOTO :COUNTER )
</code></pre>
<p>In COMMAND:<b... | 96,997 | 453,089 | 2017-03-09 15:53:46 | 3,754,830 | 11 | 2010-09-20 19:30:45 | 79,566 | 2010-09-20 19:30:45 | https://stackoverflow.com/q/3754798 | https://stackoverflow.com/a/3754830 | <p>You can simplify this down to:</p>
<pre><code>:CHECKACCOUNT
if /I "%user%"=="insertusername" GOTO ACCOUNT
GOTO CHECKPASSACCT
:CHECKPASSACCT
if /I "%pass%"=="insertpassword" GOTO ACCOUNT
GOTO COUNTER
</code></pre>
<p>The <code>ELSE</code> statements aren't needed. Since the <code>IF</code> block will jump somewhe... | <p>You can simplify this down to:</p> <pre><code>:CHECKACCOUNT if /I "%user%"=="insertusername" GOTO ACCOUNT GOTO CHECKPASSACCT :CHECKPASSACCT if /I "%pass%"=="insertpassword" GOTO ACCOUNT GOTO COUNTER </code></pre> <p>The <code>ELSE</code> statements aren't needed. Since the <code>IF</code> block will jump somewhe... | 531, 1796, 7002, 36711 | batch-file, command, scripting, windows-server | <h1>IF ELSE problem COMMAND BATCH</h1>
<p>I have problem about IF ELSE in Command Batch script...</p>
<p>In Notepad:<br>
Code:</p>
<pre><code>:CHECKACCOUNT
if /I "%user%"=="insertusername" ( GOTO :ACCOUNT ) ELSE ( GOTO :CHECKPASSACCT )
:CHECKPASSACCT
if /I "%pass%"=="insertpassword" ( GOTO :ACCOUNT ) ELSE ( GOTO :CO... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,595 | cmd | # IF ELSE problem COMMAND BATCH
I have problem about IF ELSE in Command Batch script...
In Notepad:
Code:
```
:CHECKACCOUNT
if /I "%user%"=="insertusername" ( GOTO :ACCOUNT ) ELSE ( GOTO :CHECKPASSACCT )
:CHECKPASSACCT
if /I "%pass%"=="insertpassword" ( GOTO :ACCOUNT ) ELSE ( GOTO :COUNTER )
```
In COMMAND:
Co... | You can simplify this down to:
```
:CHECKACCOUNT
if /I "%user%"=="insertusername" GOTO ACCOUNT
GOTO CHECKPASSACCT
:CHECKPASSACCT
if /I "%pass%"=="insertpassword" GOTO ACCOUNT
GOTO COUNTER
```
The `ELSE` statements aren't needed. Since the `IF` block will jump somewhere else, placing the second `GOTO` on the next lin... |
50190952 | Failed to execute CommandLineRunner - Spring Batch | 8 | 2018-05-05 15:14:43 | <p>Hi I am very new to Spring batch and I am getting the following exception which I am not able to resolve:</p>
<pre><code>java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:800) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELE... | 106,414 | 4,382,623 | 2022-04-24 04:14:50 | 50,191,789 | 11 | 2018-05-05 16:42:25 | 5,296,354 | 2018-05-05 16:42:25 | https://stackoverflow.com/q/50190952 | https://stackoverflow.com/a/50191789 | <p>When you use <code>@SpringBootApplication</code>, Spring's autoConfiguration is enabled by default. Since you have spring batch dependencies loaded in your classpath, Spring Batch AutoConfiguration is enabled as well. </p>
<p>During application startup, Spring Batch's autoconfiguration (BatchAutoConfiguration) crea... | <p>When you use <code>@SpringBootApplication</code>, Spring's autoConfiguration is enabled by default. Since you have spring batch dependencies loaded in your classpath, Spring Batch AutoConfiguration is enabled as well. </p> <p>During application startup, Spring Batch's autoconfiguration (BatchAutoConfiguration) crea... | 1211, 41895, 95875 | spring, spring-batch, spring-boot | <h1>Failed to execute CommandLineRunner - Spring Batch</h1>
<p>Hi I am very new to Spring batch and I am getting the following exception which I am not able to resolve:</p>
<pre><code>java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApp... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,598 | cmd | # Failed to execute CommandLineRunner - Spring Batch
Hi I am very new to Spring batch and I am getting the following exception which I am not able to resolve:
```
java.lang.IllegalStateException: Failed to execute CommandLineRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:800) [... | When you use `@SpringBootApplication`, Spring's autoConfiguration is enabled by default. Since you have spring batch dependencies loaded in your classpath, Spring Batch AutoConfiguration is enabled as well.
During application startup, Spring Batch's autoconfiguration (BatchAutoConfiguration) creates a Runner and it ru... |
41392845 | How to call MongoDB commands using .bat file | 8 | 2016-12-30 08:07:45 | <p>I'm trying to execute MongoDB command <em>(for create DB)</em> using .bat file.</p>
<p>For that I've tried:</p>
<pre><code>cd C:\Program Files\MongoDB\Server\3.4\bin
mongo
mongo --eval "use MyDatabase"
pause
</code></pre>
<p>But it gives an error <code>missing ; before statement @(shell eval):1:4</code> <br>
How... | 15,313 | 4,753,489 | 2020-04-06 05:59:23 | 41,393,731 | 11 | 2016-12-30 09:25:25 | 5,722,690 | 2017-12-18 08:16:34 | https://stackoverflow.com/q/41392845 | https://stackoverflow.com/a/41393731 | <p>Can you try with :</p>
<pre><code>cd Program Files\MongoDB\Server\3.4\bin
mongo.exe
mongo.exe --eval "use MyDatabase"
pause
</code></pre>
<p>I am using a .bat file which works properly and contains this</p>
<pre><code>cd \Program Files\MongoDB\Server\3.2\bin
mongod.exe
pause
</code></pre>
<p><strong>EDIT</stron... | <p>Can you try with :</p> <pre><code>cd Program Files\MongoDB\Server\3.4\bin mongo.exe mongo.exe --eval "use MyDatabase" pause </code></pre> <p>I am using a .bat file which works properly and contains this</p> <pre><code>cd \Program Files\MongoDB\Server\3.2\bin mongod.exe pause </code></pre> <p><strong>EDIT</stron... | 64, 7002, 30073 | batch-file, mongodb, windows | <h1>How to call MongoDB commands using .bat file</h1>
<p>I'm trying to execute MongoDB command <em>(for create DB)</em> using .bat file.</p>
<p>For that I've tried:</p>
<pre><code>cd C:\Program Files\MongoDB\Server\3.4\bin
mongo
mongo --eval "use MyDatabase"
pause
</code></pre>
<p>But it gives an error <code>missin... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,600 | cmd | # How to call MongoDB commands using .bat file
I'm trying to execute MongoDB command *(for create DB)* using .bat file.
For that I've tried:
```
cd C:\Program Files\MongoDB\Server\3.4\bin
mongo
mongo --eval "use MyDatabase"
pause
```
But it gives an error `missing ; before statement @(shell eval):1:4`
How can I... | Can you try with :
```
cd Program Files\MongoDB\Server\3.4\bin
mongo.exe
mongo.exe --eval "use MyDatabase"
pause
```
I am using a .bat file which works properly and contains this
```
cd \Program Files\MongoDB\Server\3.2\bin
mongod.exe
pause
```
**EDIT**
I tested a file like this and it works fine (create db, coll... |
34068830 | what's the difference between command prompt and cmd? | 8 | 2015-12-03 14:41:52 | <p>I have Windows 7, Windows 8 and Windows 10 systems and they all behave similarly.</p>
<p>When I type command prompt into the start menu and press enter, a window titled Command Prompt appears. I gave it a blue background and a green text. When I type start, cmd, or the name of a bat file into the command line, it o... | 13,785 | 2,962,323 | 2015-12-15 01:55:23 | 34,069,116 | 11 | 2015-12-03 14:56:00 | 773,113 | 2015-12-03 14:56:00 | https://stackoverflow.com/q/34068830 | https://stackoverflow.com/a/34069116 | <p>I will try to clear up some of the confusion, but I cannot do a perfect job, because Microsoft has made sure to make the mess impossible to completely untangle, <em>and</em> they change the mess with every version of windows. So, for example, some of the information I am about to provide might not apply to Windows ... | <p>I will try to clear up some of the confusion, but I cannot do a perfect job, because Microsoft has made sure to make the mess impossible to completely untangle, <em>and</em> they change the mess with every version of windows. So, for example, some of the information I am about to provide might not apply to Windows ... | 64, 2631, 7002, 9938 | batch-file, cmd, command-prompt, windows | <h1>what's the difference between command prompt and cmd?</h1>
<p>I have Windows 7, Windows 8 and Windows 10 systems and they all behave similarly.</p>
<p>When I type command prompt into the start menu and press enter, a window titled Command Prompt appears. I gave it a blue background and a green text. When I type st... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,602 | cmd | # what's the difference between command prompt and cmd?
I have Windows 7, Windows 8 and Windows 10 systems and they all behave similarly.
When I type command prompt into the start menu and press enter, a window titled Command Prompt appears. I gave it a blue background and a green text. When I type start, cmd, or the... | I will try to clear up some of the confusion, but I cannot do a perfect job, because Microsoft has made sure to make the mess impossible to completely untangle, *and* they change the mess with every version of windows. So, for example, some of the information I am about to provide might not apply to Windows 8 and Windo... |
23195109 | Robocopy invalid parameter #3 | 8 | 2014-04-21 10:03:01 | <p>Here is my batch content</p>
<pre><code>Robocopy.exe D:\IDRIVE\New backups\Program\full\1 D:\IDRIVE\New backups\Program\full\2
pause
</code></pre>
<p>But in cmd it's showing</p>
<pre><code>-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy fo... | 41,033 | 3,389,072 | 2021-08-01 16:52:20 | 23,195,175 | 11 | 2014-04-21 10:07:12 | 1,466,168 | 2021-08-01 16:52:20 | https://stackoverflow.com/q/23195109 | https://stackoverflow.com/a/23195175 | <p>You need to quote paths with <del>spaces</del> special chars (space, dot, parenthesis, ...) (<em>edit following first comment</em>) :</p>
<pre><code>Robocopy.exe "D:\IDRIVE\New backups\Program\full\1" "D:\IDRIVE\New backups\Program\full\2"
</code></pre>
<p>If you look at the error message, you wi... | <p>You need to quote paths with <del>spaces</del> special chars (space, dot, parenthesis, ...) (<em>edit following first comment</em>) :</p> <pre><code>Robocopy.exe "D:\IDRIVE\New backups\Program\full\1" "D:\IDRIVE\New backups\Program\full\2" </code></pre> <p>If you look at the error message, you wi... | 2631, 7002, 11635, 30645 | batch-file, batch-processing, cmd, robocopy | <h1>Robocopy invalid parameter #3</h1>
<p>Here is my batch content</p>
<pre><code>Robocopy.exe D:\IDRIVE\New backups\Program\full\1 D:\IDRIVE\New backups\Program\full\2
pause
</code></pre>
<p>But in cmd it's showing</p>
<pre><code>-------------------------------------------------------------------------------
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,604 | cmd | # Robocopy invalid parameter #3
Here is my batch content
```
Robocopy.exe D:\IDRIVE\New backups\Program\full\1 D:\IDRIVE\New backups\Program\full\2
pause
```
But in cmd it's showing
```
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Wind... | You need to quote paths with ~~spaces~~ special chars (space, dot, parenthesis, ...) (*edit following first comment*) :
```
Robocopy.exe "D:\IDRIVE\New backups\Program\full\1" "D:\IDRIVE\New backups\Program\full\2"
```
If you look at the error message, you will see that the mentioned path stops at new, which is just ... |
23182743 | Return control from external command to a batch file | 8 | 2014-04-20 13:00:52 | <p>I'm doing a batch file to unify all the Phonegap commands to create an app. All seems work well, but after the command <code>phonegap create appName</code> my cmd stops the batch script and doesn't continue working. I suppose that Phonegap's commands finish with an "exit" or similar, but I'm not sure.</p>
<p>Does s... | 2,547 | 2,976,632 | 2017-09-22 17:47:04 | 23,183,084 | 11 | 2014-04-20 13:37:26 | 2,299,431 | 2014-04-20 13:37:26 | https://stackoverflow.com/q/23182743 | https://stackoverflow.com/a/23183084 | <p>Try this:</p>
<pre><code>call phonegap create appName
</code></pre>
| <p>Try this:</p> <pre><code>call phonegap create appName </code></pre> | 7002, 78331 | batch-file, cordova | <h1>Return control from external command to a batch file</h1>
<p>I'm doing a batch file to unify all the Phonegap commands to create an app. All seems work well, but after the command <code>phonegap create appName</code> my cmd stops the batch script and doesn't continue working. I suppose that Phonegap's commands fini... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,605 | cmd | # Return control from external command to a batch file
I'm doing a batch file to unify all the Phonegap commands to create an app. All seems work well, but after the command `phonegap create appName` my cmd stops the batch script and doesn't continue working. I suppose that Phonegap's commands finish with an "exit" or... | Try this:
```
call phonegap create appName
``` |
22312724 | How to call a specific Python function from a batch file? | 8 | 2014-03-10 22:29:12 | <p>Let's say I have this simple Python script, named <strong>MyScript.py</strong>:</p>
<pre><code>def MyFunction(someInput):
#Do something with input
</code></pre>
<p>I would like to write a batch file that specifically calls <strong>MyFunction</strong> from <strong>MyScript</strong> with <em>someInput</em>.</p>
... | 10,341 | 158,669 | 2014-03-10 22:57:47 | 22,312,824 | 11 | 2014-03-10 22:37:16 | 1,663,352 | 2014-03-10 22:37:16 | https://stackoverflow.com/q/22312724 | https://stackoverflow.com/a/22312824 | <p>If you are in the same folder as the script you can do:</p>
<pre><code>python -c "import Myscript;Myscript.MyFunction('SomeInput')"
</code></pre>
| <p>If you are in the same folder as the script you can do:</p> <pre><code>python -c "import Myscript;Myscript.MyFunction('SomeInput')" </code></pre> | 16, 7002 | batch-file, python | <h1>How to call a specific Python function from a batch file?</h1>
<p>Let's say I have this simple Python script, named <strong>MyScript.py</strong>:</p>
<pre><code>def MyFunction(someInput):
#Do something with input
</code></pre>
<p>I would like to write a batch file that specifically calls <strong>MyFunction</s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,606 | cmd | # How to call a specific Python function from a batch file?
Let's say I have this simple Python script, named **MyScript.py**:
```
def MyFunction(someInput):
#Do something with input
```
I would like to write a batch file that specifically calls **MyFunction** from **MyScript** with *someInput*.
Now, I *could* ... | If you are in the same folder as the script you can do:
```
python -c "import Myscript;Myscript.MyFunction('SomeInput')"
``` |
21809027 | Batch file run cmd1 if time 10pm-4am else run cmd2 | 8 | 2014-02-16 08:41:43 | <p>I have a batch file and within that batch file I need to run one of two commands depending on time of my server.</p>
<p>If the time is between 22:00:00 and 03:30:00 -- xcopy /Y a\1.txt c\1.txt</p>
<p>If the time is before or after this range -- -- xcopy /Y b\1.txt c\1.txt</p>
<p>This will use xcopy to switch a file ... | 26,323 | 3,315,518 | 2020-07-01 06:26:36 | 21,809,886 | 11 | 2014-02-16 10:20:34 | 2,861,476 | 2015-12-19 10:50:21 | https://stackoverflow.com/q/21809027 | https://stackoverflow.com/a/21809886 | <pre class="lang-dos prettyprint-override"><code>@echo off
setlocal enableextensions disabledelayedexpansion
set "now=%time: =0%"
set "task=day"
if "%now%" lss "03:30:00,00" ( set "task=night" )
if "%now%" geq "22:00:00,00" ( set "task=night" )
call :task_%task%
endlocal
exit /b
:t... | <pre class="lang-dos prettyprint-override"><code>@echo off setlocal enableextensions disabledelayedexpansion set "now=%time: =0%" set "task=day" if "%now%" lss "03:30:00,00" ( set "task=night" ) if "%now%" geq "22:00:00,00" ( set "task=night" ) call :task_%task% endlocal exit /b :t... | 7002 | batch-file | <h1>Batch file run cmd1 if time 10pm-4am else run cmd2</h1>
<p>I have a batch file and within that batch file I need to run one of two commands depending on time of my server.</p>
<p>If the time is between 22:00:00 and 03:30:00 -- xcopy /Y a\1.txt c\1.txt</p>
<p>If the time is before or after this range -- -- xcopy /Y ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,607 | cmd | # Batch file run cmd1 if time 10pm-4am else run cmd2
I have a batch file and within that batch file I need to run one of two commands depending on time of my server.
If the time is between 22:00:00 and 03:30:00 -- xcopy /Y a\1.txt c\1.txt
If the time is before or after this range -- -- xcopy /Y b\1.txt c\1.txt
This... | ```
@echo off
setlocal enableextensions disabledelayedexpansion
set "now=%time: =0%"
set "task=day"
if "%now%" lss "03:30:00,00" ( set "task=night" )
if "%now%" geq "22:00:00,00" ( set "task=night" )
call :task_%task%
endlocal
exit /b
:task_day
:: do daily task
goto :eof
:... |
19597683 | Duplicate Spring Batch Job Instance | 8 | 2013-10-25 19:11:33 | <p>I have a small sample Spring Batch application that when started for the first time will work fine but whenever I shut the application down & restart the jar I always get this error:</p>
<pre><code>Caused by: org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT into BATCH_JOB_IN... | 27,851 | 456,684 | 2024-08-22 07:38:39 | 19,608,828 | 11 | 2013-10-26 16:07:28 | 456,684 | 2013-10-26 16:22:43 | https://stackoverflow.com/q/19597683 | https://stackoverflow.com/a/19608828 | <p>Found the issue. When using the <code>@EnableAutoConfiguration</code> annotation from Spring Boot it will invoke the <code>org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration</code> class which will initialize the database from the 'schema-mysql.sql' file.</p>
<p>Inside the <a href="https://github.... | <p>Found the issue. When using the <code>@EnableAutoConfiguration</code> annotation from Spring Boot it will invoke the <code>org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration</code> class which will initialize the database from the 'schema-mysql.sql' file.</p> <p>Inside the <a href="https://github.... | 17, 1211, 41895, 95875 | java, spring, spring-batch, spring-boot | <h1>Duplicate Spring Batch Job Instance</h1>
<p>I have a small sample Spring Batch application that when started for the first time will work fine but whenever I shut the application down & restart the jar I always get this error:</p>
<pre><code>Caused by: org.springframework.dao.DuplicateKeyException: PreparedSta... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,608 | cmd | # Duplicate Spring Batch Job Instance
I have a small sample Spring Batch application that when started for the first time will work fine but whenever I shut the application down & restart the jar I always get this error:
```
Caused by: org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INS... | Found the issue. When using the `@EnableAutoConfiguration` annotation from Spring Boot it will invoke the `org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration` class which will initialize the database from the 'schema-mysql.sql' file.
Inside the [schema-mysql.sql](https://github.com/spring-projects/spr... |
17244579 | How to avoid command window popping on cmd.exe | 8 | 2013-06-21 21:28:48 | <p>I have a command as:</p>
<pre><code>cmd.exe /c ping 1.1.1.1 -n 1 -w 10000 && echo second command goes here
</code></pre>
<p>But when executed it opens a command window. Is there a way to avoid the command window from popping up?</p>
<p>PS: I cannot remove cmd.exe from there. As you can see, I am trying to... | 46,201 | 356,951 | 2020-05-30 11:34:02 | 17,257,920 | 11 | 2013-06-23 05:18:00 | 2,092,609 | 2013-06-23 05:18:00 | https://stackoverflow.com/q/17244579 | https://stackoverflow.com/a/17257920 | <p>The simplest option is to start the thing minimized. Shortcut Target:</p>
<pre><code>cmd /c START /MIN \path\to\test.bat
</code></pre>
<p>or</p>
<pre><code>cmd /c START /MIN cmd /k ( ping 1.1.1.1 -w 10000 -n 1 && @ECHO All OK)
</code></pre>
<p>It's not hidden or anything, but it doesn't show up on the de... | <p>The simplest option is to start the thing minimized. Shortcut Target:</p> <pre><code>cmd /c START /MIN \path\to\test.bat </code></pre> <p>or</p> <pre><code>cmd /c START /MIN cmd /k ( ping 1.1.1.1 -w 10000 -n 1 && @ECHO All OK) </code></pre> <p>It's not hidden or anything, but it doesn't show up on the de... | 64, 1231, 1914, 7002 | batch-file, command-line, windows, windows-installer | <h1>How to avoid command window popping on cmd.exe</h1>
<p>I have a command as:</p>
<pre><code>cmd.exe /c ping 1.1.1.1 -n 1 -w 10000 && echo second command goes here
</code></pre>
<p>But when executed it opens a command window. Is there a way to avoid the command window from popping up?</p>
<p>PS: I cannot r... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,609 | cmd | # How to avoid command window popping on cmd.exe
I have a command as:
```
cmd.exe /c ping 1.1.1.1 -n 1 -w 10000 && echo second command goes here
```
But when executed it opens a command window. Is there a way to avoid the command window from popping up?
PS: I cannot remove cmd.exe from there. As you can see, I am t... | The simplest option is to start the thing minimized. Shortcut Target:
```
cmd /c START /MIN \path\to\test.bat
```
or
```
cmd /c START /MIN cmd /k ( ping 1.1.1.1 -w 10000 -n 1 && @ECHO All OK)
```
It's not hidden or anything, but it doesn't show up on the desktop or—worse—steal the focus.
If you want the window to ... |
16281185 | Read registry value that contains spaces using batch file | 8 | 2013-04-29 14:27:17 | <p>I have a batch file that reads the registry value. </p>
<p>However the entry that I am reading contains spaces and I only seem to capture everything before the first space character when setting my variable.</p>
<pre><code>set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\My Entry"
set VALUE_NAME=Home
FOR /F ... | 12,917 | 914,485 | 2020-08-21 12:58:30 | 16,282,323 | 11 | 2013-04-29 15:18:34 | 2,033,427 | 2013-04-29 15:18:34 | https://stackoverflow.com/q/16281185 | https://stackoverflow.com/a/16282323 | <p>This problem happens because the string contains spaces and the second part of the string (possibly more parts if there are more spaces) are treated as another token (in 4, 5, etc.) To fix this, pass the rest of the line to %%C with an asterisk like this:</p>
<pre><code>FOR /F "usebackq skip=2 tokens=1,2*" %%A IN (... | <p>This problem happens because the string contains spaces and the second part of the string (possibly more parts if there are more spaces) are treated as another token (in 4, 5, etc.) To fix this, pass the rest of the line to %%C with an asterisk like this:</p> <pre><code>FOR /F "usebackq skip=2 tokens=1,2*" %%A IN (... | 263, 7002 | batch-file, registry | <h1>Read registry value that contains spaces using batch file</h1>
<p>I have a batch file that reads the registry value. </p>
<p>However the entry that I am reading contains spaces and I only seem to capture everything before the first space character when setting my variable.</p>
<pre><code>set KEY_NAME="HKEY_LOCAL_... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,610 | cmd | # Read registry value that contains spaces using batch file
I have a batch file that reads the registry value.
However the entry that I am reading contains spaces and I only seem to capture everything before the first space character when setting my variable.
```
set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node... | This problem happens because the string contains spaces and the second part of the string (possibly more parts if there are more spaces) are treated as another token (in 4, 5, etc.) To fix this, pass the rest of the line to %%C with an asterisk like this:
```
FOR /F "usebackq skip=2 tokens=1,2*" %%A IN (`REG QUERY %KE... |
15878810 | How to execute command on cmd from C# | 8 | 2013-04-08 12:16:14 | <p>I want to run commands on the cmd from my C# app.</p>
<p>I tried: </p>
<pre><code>string strCmdText = "ipconfig";
System.Diagnostics.Process.Start("CMD.exe", strCmdText);
</code></pre>
<p><strong>result:</strong> </p>
<p>the cmd window pop but the command didn't do nothing.</p>
<p>why?</p>
| 57,022 | 2,257,505 | 2019-10-22 04:58:17 | 15,878,831 | 11 | 2013-04-08 12:17:38 | 1,749,895 | 2013-04-08 12:20:25 | https://stackoverflow.com/q/15878810 | https://stackoverflow.com/a/15878831 | <p>Use </p>
<pre><code>System.Diagnostics.Process.Start("CMD.exe", "/C ipconfig");
</code></pre>
<p>If you want to have cmd still opened use: </p>
<pre><code>System.Diagnostics.Process.Start("CMD.exe", "/K ipconfig");
</code></pre>
| <p>Use </p> <pre><code>System.Diagnostics.Process.Start("CMD.exe", "/C ipconfig"); </code></pre> <p>If you want to have cmd still opened use: </p> <pre><code>System.Diagnostics.Process.Start("CMD.exe", "/K ipconfig"); </code></pre> | 9, 2631 | c#, cmd | <h1>How to execute command on cmd from C#</h1>
<p>I want to run commands on the cmd from my C# app.</p>
<p>I tried: </p>
<pre><code>string strCmdText = "ipconfig";
System.Diagnostics.Process.Start("CMD.exe", strCmdText);
</code></pre>
<p><strong>result:</strong> </p>
<p>the cmd window pop but the command... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,611 | cmd | # How to execute command on cmd from C#
I want to run commands on the cmd from my C# app.
I tried:
```
string strCmdText = "ipconfig";
System.Diagnostics.Process.Start("CMD.exe", strCmdText);
```
**result:**
the cmd window pop but the command didn't do nothing.
why? | Use
```
System.Diagnostics.Process.Start("CMD.exe", "/C ipconfig");
```
If you want to have cmd still opened use:
```
System.Diagnostics.Process.Start("CMD.exe", "/K ipconfig");
``` |
15585659 | Start a CMD, then echo off of it, then clear the screen | 8 | 2013-03-23 10:25:47 | <p>Here are the steps I need, I am using a batch script</p>
<ol>
<li>Open a cmd with path set to the desktop</li>
<li>Then set it's echo off</li>
<li>Then clear the screen</li>
<li>Then wait for me to type commands</li>
</ol>
<p>So I can enter the commands directly without a long line blocking the view</p>
<p>Code I... | 91,529 | 2,201,976 | 2018-07-02 16:46:28 | 15,586,103 | 11 | 2013-03-23 11:16:26 | 2,152,082 | 2018-07-02 16:46:28 | https://stackoverflow.com/q/15585659 | https://stackoverflow.com/a/15586103 | <p>Try this line:</p>
<pre><code>start /D "C:\Documents and Settings\Administrator\Desktop" cmd /k "prompt $"
</code></pre>
<p><code>/D <path></code> will set your working directory</p>
<p><code>Prompt $</code> will set your prompt to "nothing", only the blinking cursor will display</p>
| <p>Try this line:</p> <pre><code>start /D "C:\Documents and Settings\Administrator\Desktop" cmd /k "prompt $" </code></pre> <p><code>/D <path></code> will set your working directory</p> <p><code>Prompt $</code> will set your prompt to "nothing", only the blinking cursor will display</p> | 7002 | batch-file | <h1>Start a CMD, then echo off of it, then clear the screen</h1>
<p>Here are the steps I need, I am using a batch script</p>
<ol>
<li>Open a cmd with path set to the desktop</li>
<li>Then set it's echo off</li>
<li>Then clear the screen</li>
<li>Then wait for me to type commands</li>
</ol>
<p>So I can enter the comma... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,612 | cmd | # Start a CMD, then echo off of it, then clear the screen
Here are the steps I need, I am using a batch script
1. Open a cmd with path set to the desktop
2. Then set it's echo off
3. Then clear the screen
4. Then wait for me to type commands
So I can enter the commands directly without a long line blocking the view
... | Try this line:
```
start /D "C:\Documents and Settings\Administrator\Desktop" cmd /k "prompt $"
```
`/D <path>` will set your working directory
`Prompt $` will set your prompt to "nothing", only the blinking cursor will display |
11249339 | for loop working in CMD prompt but not in batch file - for loop was copy pasted | 8 | 2012-06-28 16:49:03 | <p>Note: I have almost no idea at all how batch file 'for' loops work. </p>
<p>The batch file I have currently:</p>
<pre><code>"C:\Program Files (x86)\HMA! Pro VPN\bin\HMA! Pro VPN.exe" -connect
"C:\Program Files (x86)\HMA! Pro VPN\bin\HMA! Pro VPN.exe" -changeip
ping -w 2000 -n 1 1.1.1.1
:wait
for /f "usebackq tok... | 6,944 | 1,483,358 | 2012-06-28 17:16:54 | 11,249,731 | 11 | 2012-06-28 17:16:54 | 463,115 | 2012-06-28 17:16:54 | https://stackoverflow.com/q/11249339 | https://stackoverflow.com/a/11249731 | <p>In a batch file you have to use two percents for <code>FOR</code> parameters, that's all</p>
<pre><code>for /f "usebackq tokens=1,2,3,*" %%A in (`netsh interface show interface`) do (
if "%%D"=="Local Area Connection 2" set state=%%B
)
</code></pre>
| <p>In a batch file you have to use two percents for <code>FOR</code> parameters, that's all</p> <pre><code>for /f "usebackq tokens=1,2,3,*" %%A in (`netsh interface show interface`) do ( if "%%D"=="Local Area Connection 2" set state=%%B ) </code></pre> | 633, 2531, 7002 | batch-file, for-loop, vpn | <h1>for loop working in CMD prompt but not in batch file - for loop was copy pasted</h1>
<p>Note: I have almost no idea at all how batch file 'for' loops work. </p>
<p>The batch file I have currently:</p>
<pre><code>"C:\Program Files (x86)\HMA! Pro VPN\bin\HMA! Pro VPN.exe" -connect
"C:\Program Files (x86)\HMA! Pro V... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,613 | cmd | # for loop working in CMD prompt but not in batch file - for loop was copy pasted
Note: I have almost no idea at all how batch file 'for' loops work.
The batch file I have currently:
```
"C:\Program Files (x86)\HMA! Pro VPN\bin\HMA! Pro VPN.exe" -connect
"C:\Program Files (x86)\HMA! Pro VPN\bin\HMA! Pro VPN.exe" -ch... | In a batch file you have to use two percents for `FOR` parameters, that's all
```
for /f "usebackq tokens=1,2,3,*" %%A in (`netsh interface show interface`) do (
if "%%D"=="Local Area Connection 2" set state=%%B
)
``` |
9318614 | .bat file to create a complex string variable with special characters | 8 | 2012-02-16 20:32:35 | <p>I need to create a single string variable by concatenating multiple strings. The final string i need is as below</p>
<pre><code><Workspace name="RealTimeRiskUSD_UA" path="C:\workspace" IsAdmin="false" />
</code></pre>
<p>This is what i tried.</p>
<pre><code>echo off
set path1="<Workspace "
set name="name... | 26,422 | 557,429 | 2022-04-12 06:58:33 | 9,319,197 | 11 | 2012-02-16 21:17:08 | 463,115 | 2012-02-16 21:17:08 | https://stackoverflow.com/q/9318614 | https://stackoverflow.com/a/9319197 | <p>You could use the extended syntax of SET.
set "var=content". </p>
<p>This escapes special characters, but the quotes aren't part of the string. </p>
<pre><code>echo off
Setlocal EnableDelayedExpansion
set "path1=<Workspace "
set "name=name="RealTimeRiskUSD_UA""
set "path2=path="C:\workspace" IsAdmin="false"... | <p>You could use the extended syntax of SET. set "var=content". </p> <p>This escapes special characters, but the quotes aren't part of the string. </p> <pre><code>echo off Setlocal EnableDelayedExpansion set "path1=<Workspace " set "name=name="RealTimeRiskUSD_UA"" set "path2=path="C:\workspace" IsAdmin="false"... | 7002 | batch-file | <h1>.bat file to create a complex string variable with special characters</h1>
<p>I need to create a single string variable by concatenating multiple strings. The final string i need is as below</p>
<pre><code><Workspace name="RealTimeRiskUSD_UA" path="C:\workspace" IsAdmin="false" />
</code></pre>
<p>This is w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,614 | cmd | # .bat file to create a complex string variable with special characters
I need to create a single string variable by concatenating multiple strings. The final string i need is as below
```
<Workspace name="RealTimeRiskUSD_UA" path="C:\workspace" IsAdmin="false" />
```
This is what i tried.
```
echo off
set path1="<... | You could use the extended syntax of SET.
set "var=content".
This escapes special characters, but the quotes aren't part of the string.
```
echo off
Setlocal EnableDelayedExpansion
set "path1=<Workspace "
set "name=name="RealTimeRiskUSD_UA""
set "path2=path="C:\workspace" IsAdmin="false" />"
set "fullpath=%path1%%... |
2182568 | Batch script is not executed if chcp was called | 8 | 2010-02-02 07:58:48 | <p>I'm trying to delete some files with unicode characters in them with batch script (it's a requirement). So I run cmd and execute:</p>
<pre><code>> chcp 65001
</code></pre>
<p>Effectively setting codepage to UTF-8. And it works:</p>
<pre><code>D:\temp\1>dir
Volume in drive D has no label.
Volume Serial Num... | 14,618 | 199,621 | 2013-09-24 17:19:45 | 2,462,138 | 11 | 2010-03-17 12:26:17 | 276,203 | 2010-03-17 12:26:17 | https://stackoverflow.com/q/2182568 | https://stackoverflow.com/a/2462138 | <p>If you want to have unicode supported in batch file, then CHCP on a line by itself just aborts the batch file. What I suggest is putting CHCP on each batch file line that needs unicode as follows</p>
<pre><code>chcp 65001 > nul && <real command here>
</code></pre>
<p>Example: In my case I wanted ... | <p>If you want to have unicode supported in batch file, then CHCP on a line by itself just aborts the batch file. What I suggest is putting CHCP on each batch file line that needs unicode as follows</p> <pre><code>chcp 65001 > nul && <real command here> </code></pre> <p>Example: In my case I wanted ... | 279, 2631, 7002 | batch-file, cmd, unicode | <h1>Batch script is not executed if chcp was called</h1>
<p>I'm trying to delete some files with unicode characters in them with batch script (it's a requirement). So I run cmd and execute:</p>
<pre><code>> chcp 65001
</code></pre>
<p>Effectively setting codepage to UTF-8. And it works:</p>
<pre><code>D:\temp\1&g... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,615 | cmd | # Batch script is not executed if chcp was called
I'm trying to delete some files with unicode characters in them with batch script (it's a requirement). So I run cmd and execute:
```
> chcp 65001
```
Effectively setting codepage to UTF-8. And it works:
```
D:\temp\1>dir
Volume in drive D has no label.
Volume Ser... | If you want to have unicode supported in batch file, then CHCP on a line by itself just aborts the batch file. What I suggest is putting CHCP on each batch file line that needs unicode as follows
```
chcp 65001 > nul && <real command here>
```
Example: In my case I wanted to have a nice TAIL of my log files while deb... |
55434653 | Batch Normalization doesn't have gradient in tensorflow 2.0? | 7 | 2019-03-30 18:47:28 | <p>I am trying to make a simple GANs to generate digits from the MNIST dataset. However when I get to training(which is custom) I get this annoying warning that I suspect is the cause of not training like I'm used to.</p>
<p>Keep in mind this is all in tensorflow 2.0 using it's default eager execution.</p>
<p>GET THE... | 3,902 | 1,930,737 | 2019-03-30 22:13:19 | 55,436,103 | 11 | 2019-03-30 22:13:19 | 9,393,102 | 2019-03-30 22:13:19 | https://stackoverflow.com/q/55434653 | https://stackoverflow.com/a/55436103 | <p>The problem is here:</p>
<pre><code>gradients_of_generator = gen_tape.gradient(gen_loss, generator.variables)
</code></pre>
<p>You should only be getting gradients for the <em>trainable</em> variables. So you should change it to </p>
<pre><code>gradients_of_generator = gen_tape.gradient(gen_loss, generator.traina... | <p>The problem is here:</p> <pre><code>gradients_of_generator = gen_tape.gradient(gen_loss, generator.variables) </code></pre> <p>You should only be getting gradients for the <em>trainable</em> variables. So you should change it to </p> <pre><code>gradients_of_generator = gen_tape.gradient(gen_loss, generator.traina... | 60010, 115813, 124994, 137329 | batch-normalization, python-3.x, tensorflow, tensorflow2.0 | <h1>Batch Normalization doesn't have gradient in tensorflow 2.0?</h1>
<p>I am trying to make a simple GANs to generate digits from the MNIST dataset. However when I get to training(which is custom) I get this annoying warning that I suspect is the cause of not training like I'm used to.</p>
<p>Keep in mind this is all... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,616 | cmd | # Batch Normalization doesn't have gradient in tensorflow 2.0?
I am trying to make a simple GANs to generate digits from the MNIST dataset. However when I get to training(which is custom) I get this annoying warning that I suspect is the cause of not training like I'm used to.
Keep in mind this is all in tensorflow 2... | The problem is here:
```
gradients_of_generator = gen_tape.gradient(gen_loss, generator.variables)
```
You should only be getting gradients for the *trainable* variables. So you should change it to
```
gradients_of_generator = gen_tape.gradient(gen_loss, generator.trainable_variables)
```
The same goes for the thre... |
52446523 | How to use groovy env. variable in Jenkins to pass through bat command in Jenkins pipeline | 7 | 2018-09-21 15:05:01 | <p>I have stage in my jenkinsfile, that executes a bat command:</p>
<pre><code>stage ('build'){
bat '%cd%\\MySimpleProject\\bin\\Execute.bat "${env.BRANCH_NAME}"'
}
</code></pre>
<p>My batch command requires a parameter that is the current branch in svn.</p>
<p>When I use this:</p>
<p>echo "SVN_BRANCH_NAME is ${e... | 12,412 | 1,670,340 | 2022-11-14 12:16:33 | 52,451,571 | 11 | 2018-09-21 22:07:57 | 4,244,387 | 2018-09-21 22:07:57 | https://stackoverflow.com/q/52446523 | https://stackoverflow.com/a/52451571 | <p>It's because all is wrapped in single quotes and groovy won't interpolate the string. Try </p>
<pre><code>stage ('build'){ bat "%cd%\\MySimpleProject\\bin\\Execute.bat ${env.BRANCH_NAME}"}
</code></pre>
| <p>It's because all is wrapped in single quotes and groovy won't interpolate the string. Try </p> <pre><code>stage ('build'){ bat "%cd%\\MySimpleProject\\bin\\Execute.bat ${env.BRANCH_NAME}"} </code></pre> | 7002, 64999, 116724, 118285 | batch-file, jenkins, jenkins-groovy, jenkins-pipeline | <h1>How to use groovy env. variable in Jenkins to pass through bat command in Jenkins pipeline</h1>
<p>I have stage in my jenkinsfile, that executes a bat command:</p>
<pre><code>stage ('build'){
bat '%cd%\\MySimpleProject\\bin\\Execute.bat "${env.BRANCH_NAME}"'
}
</code></pre>
<p>My batch command requires a parame... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,617 | cmd | # How to use groovy env. variable in Jenkins to pass through bat command in Jenkins pipeline
I have stage in my jenkinsfile, that executes a bat command:
```
stage ('build'){
bat '%cd%\\MySimpleProject\\bin\\Execute.bat "${env.BRANCH_NAME}"'
}
```
My batch command requires a parameter that is the current branch in... | It's because all is wrapped in single quotes and groovy won't interpolate the string. Try
```
stage ('build'){ bat "%cd%\\MySimpleProject\\bin\\Execute.bat ${env.BRANCH_NAME}"}
``` |
44121471 | HTML5 audio is not playing in my React app in localhost | 7 | 2017-05-22 20:18:28 | <p>I'm making an mp3 player with React.js and the HTML5 web audio javascript API. I've just been learning React for two weeks so I'm just getting used to the structure and setup (with components etc) however have several years experience with JavaScript.</p>
<p>I had the mp3 player working when using React within the ... | 15,620 | 2,686,581 | 2022-07-06 19:57:23 | 44,158,320 | 11 | 2017-05-24 12:22:14 | 2,686,581 | 2022-07-06 19:57:23 | https://stackoverflow.com/q/44121471 | https://stackoverflow.com/a/44158320 | <p>After some experimenting I discovered that the mp3 file needs to be imported (using <code>import</code>) in order to be able to play it within this environment.</p>
<p>So i've found a solution and edited my AudioPlayer component as follows (which works perfect):</p>
<pre><code>import React, { Component } from 'react... | <p>After some experimenting I discovered that the mp3 file needs to be imported (using <code>import</code>) in order to be able to play it within this environment.</p> <p>So i've found a solution and edited my AudioPlayer component as follows (which works perfect):</p> <pre><code>import React, { Component } from 'react... | 3, 2631, 5996, 59464, 92497 | cmd, html5-audio, javascript, localhost, reactjs | <h1>HTML5 audio is not playing in my React app in localhost</h1>
<p>I'm making an mp3 player with React.js and the HTML5 web audio javascript API. I've just been learning React for two weeks so I'm just getting used to the structure and setup (with components etc) however have several years experience with JavaScript.<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,618 | cmd | # HTML5 audio is not playing in my React app in localhost
I'm making an mp3 player with React.js and the HTML5 web audio javascript API. I've just been learning React for two weeks so I'm just getting used to the structure and setup (with components etc) however have several years experience with JavaScript.
I had th... | After some experimenting I discovered that the mp3 file needs to be imported (using `import`) in order to be able to play it within this environment.
So i've found a solution and edited my AudioPlayer component as follows (which works perfect):
```
import React, { Component } from 'react';
import './music-player.css'... |
32200879 | How to get disk space of windows machine with R? | 7 | 2015-08-25 09:54:39 | <p>How can I get the total disk space / free disk space of my windows computer ?</p>
<p>If there is no R function, maybe there is a windows command that I could use within the R <code>system</code> function but I wasn't able to find that command.</p>
| 3,268 | 2,667,955 | 2018-09-24 11:21:31 | 32,201,389 | 11 | 2015-08-25 10:19:07 | 1,457,051 | 2015-08-25 13:40:02 | https://stackoverflow.com/q/32200879 | https://stackoverflow.com/a/32201389 | <p>Though I find it <em>really</em> difficult to believe that a Google search for <code>windows cmd disk space</code> came up empty for you, this should provide the information you need w/o the need for admin privileges:</p>
<pre><code>disks <- system("wmic logicaldisk get size,freespace,caption", inter=TRUE)
disk... | <p>Though I find it <em>really</em> difficult to believe that a Google search for <code>windows cmd disk space</code> came up empty for you, this should provide the information you need w/o the need for admin privileges:</p> <pre><code>disks <- system("wmic logicaldisk get size,freespace,caption", inter=TRUE) disk... | 64, 2631, 4452 | cmd, r, windows | <h1>How to get disk space of windows machine with R?</h1>
<p>How can I get the total disk space / free disk space of my windows computer ?</p>
<p>If there is no R function, maybe there is a windows command that I could use within the R <code>system</code> function but I wasn't able to find that command.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,619 | cmd | # How to get disk space of windows machine with R?
How can I get the total disk space / free disk space of my windows computer ?
If there is no R function, maybe there is a windows command that I could use within the R `system` function but I wasn't able to find that command. | Though I find it *really* difficult to believe that a Google search for `windows cmd disk space` came up empty for you, this should provide the information you need w/o the need for admin privileges:
```
disks <- system("wmic logicaldisk get size,freespace,caption", inter=TRUE)
disks <- read.fwf(textConnection(disks[... |
29031155 | Spring Batch - Skip Record On Process | 7 | 2015-03-13 11:32:54 | <p>I wanted to skip some record on process.</p>
<p>what i have tried is, i have created custom exception and throw the exception when i want to skip the record and its calling the Skip listener onSkipInProcess method.Its working fine.</p>
<p>please find the configuration.</p>
<pre><code> <batch:chunk reader="mast... | 32,317 | 1,907,755 | 2024-06-10 13:09:36 | 29,048,138 | 11 | 2015-03-14 11:01:21 | 4,617,377 | 2015-03-14 11:01:21 | https://stackoverflow.com/q/29031155 | https://stackoverflow.com/a/29048138 | <p>There are indeed two ways to do this, one like you mention with skip mechanism and the other with returning <code>null</code> which will filter out item and not write it. Here is <a href="http://docs.spring.io/spring-batch/trunk/reference/html/readersAndWriters.html" rel="noreferrer">documentation link - 6.3.2. Filt... | <p>There are indeed two ways to do this, one like you mention with skip mechanism and the other with returning <code>null</code> which will filter out item and not write it. Here is <a href="http://docs.spring.io/spring-batch/trunk/reference/html/readersAndWriters.html" rel="noreferrer">documentation link - 6.3.2. Filt... | 41895 | spring-batch | <h1>Spring Batch - Skip Record On Process</h1>
<p>I wanted to skip some record on process.</p>
<p>what i have tried is, i have created custom exception and throw the exception when i want to skip the record and its calling the Skip listener onSkipInProcess method.Its working fine.</p>
<p>please find the configuration... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,621 | cmd | # Spring Batch - Skip Record On Process
I wanted to skip some record on process.
what i have tried is, i have created custom exception and throw the exception when i want to skip the record and its calling the Skip listener onSkipInProcess method.Its working fine.
please find the configuration.
```
<batch:chunk re... | There are indeed two ways to do this, one like you mention with skip mechanism and the other with returning `null` which will filter out item and not write it. Here is [documentation link - 6.3.2. Filtering records](http://docs.spring.io/spring-batch/trunk/reference/html/readersAndWriters.html) where it is nicely expla... |
25550690 | Mongoid Batch Update/Upsert Alternative? | 7 | 2014-08-28 13:58:45 | <p>I know that Mongoid v3+ supports batch inserts via <code>Model.collection.insert()</code>. However, I don't think it supports batch updates where the attributes differ for each record (so I don't think <code>update_all</code> would work either). Is there a way to do batch update/upsert instead of a single-record loo... | 3,144 | 422,304 | 2016-12-01 20:31:21 | 25,673,545 | 11 | 2014-09-04 19:25:11 | 1,316,225 | 2014-09-04 19:25:11 | https://stackoverflow.com/q/25550690 | https://stackoverflow.com/a/25673545 | <p>MongoDB 2.6 supports the <code>update</code> command, see <a href="http://docs.mongodb.org/manual/reference/command/update/">http://docs.mongodb.org/manual/reference/command/update/</a></p>
<p><code>Mongoid.default_session</code> gives you corresponding access to the <code>command</code> method at the MongoDB datab... | <p>MongoDB 2.6 supports the <code>update</code> command, see <a href="http://docs.mongodb.org/manual/reference/command/update/">http://docs.mongodb.org/manual/reference/command/update/</a></p> <p><code>Mongoid.default_session</code> gives you corresponding access to the <code>command</code> method at the MongoDB datab... | 4984, 30073, 30645, 51855 | batch-processing, mongodb, mongoid, ruby-on-rails | <h1>Mongoid Batch Update/Upsert Alternative?</h1>
<p>I know that Mongoid v3+ supports batch inserts via <code>Model.collection.insert()</code>. However, I don't think it supports batch updates where the attributes differ for each record (so I don't think <code>update_all</code> would work either). Is there a way to do ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,622 | cmd | # Mongoid Batch Update/Upsert Alternative?
I know that Mongoid v3+ supports batch inserts via `Model.collection.insert()`. However, I don't think it supports batch updates where the attributes differ for each record (so I don't think `update_all` would work either). Is there a way to do batch update/upsert instead of ... | MongoDB 2.6 supports the `update` command, see <http://docs.mongodb.org/manual/reference/command/update/>
`Mongoid.default_session` gives you corresponding access to the `command` method at the MongoDB database level.
The following example shows how to construct and issue a bulk update command that should answer your ... |
20613244 | gradle: Execute task "type:Exec" with many arguments with spaces | 7 | 2013-12-16 14:27:14 | <p>I have the gradle task that should create Websphere profile on Windows OS</p>
<pre><code>task createProfile(type:Exec) {
def commandToExecute = new StringBuffer()
def profile = 'AppSrv02'
def wasHome = 'C:/IBM new/WebSphere/AppServer'
def str = new LinkedList <String> ();
str.add('cmd')
... | 17,086 | 2,565,403 | 2017-09-19 10:03:17 | 23,243,484 | 11 | 2014-04-23 11:53:14 | 2,565,403 | 2014-04-23 12:15:41 | https://stackoverflow.com/q/20613244 | https://stackoverflow.com/a/23243484 | <p>If somebody needed it, we found a workaround for this problem. The task finally looks like:</p>
<pre><code>task createProfile(type: Exec) {
executable = new File(wsadminLocation, manageProfilesFileName)
def templatePath = wasHome + File.separator + "profileTemplates" + File.separator + "default"
def arg... | <p>If somebody needed it, we found a workaround for this problem. The task finally looks like:</p> <pre><code>task createProfile(type: Exec) { executable = new File(wsadminLocation, manageProfilesFileName) def templatePath = wasHome + File.separator + "profileTemplates" + File.separator + "default" def arg... | 5162, 7002, 7932, 32307, 34798 | batch-file, exec, gradle, processbuilder, spaces | <h1>gradle: Execute task "type:Exec" with many arguments with spaces</h1>
<p>I have the gradle task that should create Websphere profile on Windows OS</p>
<pre><code>task createProfile(type:Exec) {
def commandToExecute = new StringBuffer()
def profile = 'AppSrv02'
def wasHome = 'C:/IBM new/WebSphere/AppSe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,623 | cmd | # gradle: Execute task "type:Exec" with many arguments with spaces
I have the gradle task that should create Websphere profile on Windows OS
```
task createProfile(type:Exec) {
def commandToExecute = new StringBuffer()
def profile = 'AppSrv02'
def wasHome = 'C:/IBM new/WebSphere/AppServer'
def str =... | If somebody needed it, we found a workaround for this problem. The task finally looks like:
```
task createProfile(type: Exec) {
executable = new File(wsadminLocation, manageProfilesFileName)
def templatePath = wasHome + File.separator + "profileTemplates" + File.separator + "default"
def argsList = ["-cre... |
22636308 | windows cmd: problems with for /f with a quoted command with quoted parameters | 7 | 2014-03-25 13:37:57 | <pre><code>for /f "delims=" %%a in ('"%systemRoot%\system32\find.exe" /?') do @echo %%a
</code></pre>
<p>Yes, the previous line works. Not much useful but works. But trying write a batch file to answer another question, i faced something like</p>
<pre><code> for /f %%a in ('"%systemRoot%\system32\find.exe" /c /v "" ^... | 3,013 | 2,861,476 | 2017-03-01 20:28:07 | 22,636,725 | 11 | 2014-03-25 13:55:06 | 2,299,431 | 2014-03-25 14:18:27 | https://stackoverflow.com/q/22636308 | https://stackoverflow.com/a/22636725 | <p>Here are two solutions. </p>
<p>1) has surrounding double quotes and removed ^ escape character.<br>
2) uses find as it is on the path.</p>
<pre><code>for /f %%a in ('""%systemRoot%\system32\find.exe" /c /v "" < "c:\something.txt""') do @echo %%a
for /f %%a in (' find.exe /c /v "" ^< "c:\something.txt"') d... | <p>Here are two solutions. </p> <p>1) has surrounding double quotes and removed ^ escape character.<br> 2) uses find as it is on the path.</p> <pre><code>for /f %%a in ('""%systemRoot%\system32\find.exe" /c /v "" < "c:\something.txt""') do @echo %%a for /f %%a in (' find.exe /c /v "" ^< "c:\something.txt"') d... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>windows cmd: problems with for /f with a quoted command with quoted parameters</h1>
<pre><code>for /f "delims=" %%a in ('"%systemRoot%\system32\find.exe" /?') do @echo %%a
</code></pre>
<p>Yes, the previous line works. Not much useful but works. But trying write a batch file to answer another question, i faced som... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,624 | cmd | # windows cmd: problems with for /f with a quoted command with quoted parameters
```
for /f "delims=" %%a in ('"%systemRoot%\system32\find.exe" /?') do @echo %%a
```
Yes, the previous line works. Not much useful but works. But trying write a batch file to answer another question, i faced something like
```
for /f %... | Here are two solutions.
1) has surrounding double quotes and removed ^ escape character.
2) uses find as it is on the path.
```
for /f %%a in ('""%systemRoot%\system32\find.exe" /c /v "" < "c:\something.txt""') do @echo %%a
for /f %%a in (' find.exe /c /v "" ^< "c:\something.txt"') do @echo %%a
```
It's to do wit... |
21704088 | how to pass blank to batch file as parameter | 7 | 2014-02-11 14:05:20 | <p>I need to pass blank("" or " ") to a batch file as parameter. </p>
<p>I have to pass the runtime values to a url. My url is: </p>
<pre><code>start iexplore http://example.com?emailAddress=%1&name=%2&phone=%3&dateofbirth=%4&hobby=%5&address=%6
</code></pre>
<p>Everything works fine if all para... | 5,697 | 1,989,988 | 2020-10-17 11:45:47 | 21,704,433 | 11 | 2014-02-11 14:21:16 | 2,128,947 | 2020-10-17 11:45:47 | https://stackoverflow.com/q/21704088 | https://stackoverflow.com/a/21704433 | <p>Use <code>%~x</code> instead of <code>%x</code> (where x is your parameter number)</p>
<p>This removes any enclosing quotes from the paramater, hence</p>
<pre><code>echo parameter3=%~3
</code></pre>
<p>would show <code>parameter3=</code></p>
<p>if you called this with <code>yourbatch one two "" four</code>... | <p>Use <code>%~x</code> instead of <code>%x</code> (where x is your parameter number)</p> <p>This removes any enclosing quotes from the paramater, hence</p> <pre><code>echo parameter3=%~3 </code></pre> <p>would show <code>parameter3=</code></p> <p>if you called this with <code>yourbatch one two "" four</code>... | 7002 | batch-file | <h1>how to pass blank to batch file as parameter</h1>
<p>I need to pass blank("" or " ") to a batch file as parameter. </p>
<p>I have to pass the runtime values to a url. My url is: </p>
<pre><code>start iexplore http://example.com?emailAddress=%1&name=%2&phone=%3&dateofbirth=%4&hobby=%5&address=... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,625 | cmd | # how to pass blank to batch file as parameter
I need to pass blank("" or " ") to a batch file as parameter.
I have to pass the runtime values to a url. My url is:
```
start iexplore http://example.com?emailAddress=%1&name=%2&phone=%3&dateofbirth=%4&hobby=%5&address=%6
```
Everything works fine if all parameters ha... | Use `%~x` instead of `%x` (where x is your parameter number)
This removes any enclosing quotes from the paramater, hence
```
echo parameter3=%~3
```
would show `parameter3=`
if you called this with `yourbatch one two "" four`
If you pass `"``space``"` as a parameter then this will show a space as `%~3` (which is a... |
21330060 | Delphi run as different user | 7 | 2014-01-24 10:19:30 | <p>I want a way in Delphi which I can run an exe file as a different user in order to gain different permissions. I do not want elevation of permissions.
Screenshot:</p>
<p><img src="https://i.sstatic.net/EPKde.jpg" alt="enter image description here"></p>
<p>I want from delphi code to start an application as a differ... | 2,715 | 948,553 | 2014-01-24 11:46:25 | 21,331,856 | 11 | 2014-01-24 11:46:25 | 505,088 | 2014-01-24 11:46:25 | https://stackoverflow.com/q/21330060 | https://stackoverflow.com/a/21331856 | <p>The API function that you are looking for is <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa375177.aspx"><code>CredUIPromptForCredentials</code></a>. This returns a username and password that you can pass to <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms682431.aspx"><code>Cre... | <p>The API function that you are looking for is <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa375177.aspx"><code>CredUIPromptForCredentials</code></a>. This returns a username and password that you can pass to <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms682431.aspx"><code>Cre... | 118, 889, 2631 | cmd, delphi, winapi | <h1>Delphi run as different user</h1>
<p>I want a way in Delphi which I can run an exe file as a different user in order to gain different permissions. I do not want elevation of permissions.
Screenshot:</p>
<p><img src="https://i.sstatic.net/EPKde.jpg" alt="enter image description here"></p>
<p>I want from delphi co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,626 | cmd | # Delphi run as different user
I want a way in Delphi which I can run an exe file as a different user in order to gain different permissions. I do not want elevation of permissions.
Screenshot:

I want from delphi code to start an application as a diffe... | The API function that you are looking for is [`CredUIPromptForCredentials`](http://msdn.microsoft.com/en-us/library/windows/desktop/aa375177.aspx). This returns a username and password that you can pass to [`CreateProcessWithLogonW`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms682431.aspx). |
21029313 | Command Line Variable for .NET Framework | 7 | 2014-01-09 19:25:29 | <p>I'm trying to write a batch file that installs a windows service using installutil.exe. I would like to use the installutil.exe that is in the latest version of the .Net Framework (located in C:\Windows\Microsoft.NET\Framework\v4.0.30319 on my machine).</p>
<p>Is there an easy way to change the directory in the co... | 2,910 | 1,523,851 | 2014-01-09 20:32:44 | 21,030,528 | 11 | 2014-01-09 20:32:44 | 1,523,851 | 2014-01-09 20:32:44 | https://stackoverflow.com/q/21029313 | https://stackoverflow.com/a/21030528 | <p>Using Reed Copseys advice about inspecting the registry I found a sample on <a href="https://stackoverflow.com/a/9422501/1523851">another post</a> about how to read the registry from a batch file.</p>
<p>Here is my batch file that finds the install directory for the .Net 4 Framework and installs my service:</p>
<p... | <p>Using Reed Copseys advice about inspecting the registry I found a sample on <a href="https://stackoverflow.com/a/9422501/1523851">another post</a> about how to read the registry from a batch file.</p> <p>Here is my batch file that finds the install directory for the .Net 4 Framework and installs my service:</p> <p... | 1, 1231, 7002 | .net, batch-file, command-line | <h1>Command Line Variable for .NET Framework</h1>
<p>I'm trying to write a batch file that installs a windows service using installutil.exe. I would like to use the installutil.exe that is in the latest version of the .Net Framework (located in C:\Windows\Microsoft.NET\Framework\v4.0.30319 on my machine).</p>
<p>Is t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,627 | cmd | # Command Line Variable for .NET Framework
I'm trying to write a batch file that installs a windows service using installutil.exe. I would like to use the installutil.exe that is in the latest version of the .Net Framework (located in C:\Windows\Microsoft.NET\Framework\v4.0.30319 on my machine).
Is there an easy way ... | Using Reed Copseys advice about inspecting the registry I found a sample on [another post](https://stackoverflow.com/a/9422501/1523851) about how to read the registry from a batch file.
Here is my batch file that finds the install directory for the .Net 4 Framework and installs my service:
```
@SET INSTALLUTILDIR=
@f... |
19642548 | batch find command not working | 7 | 2013-10-28 18:38:20 | <p>does anyone know why this would not work (Windows 7, batch script)?</p>
<pre><code>C:\testing>FINDSTR /R /N "^.*$" test.txt | FIND /C ":"
FIND: `/C': No such file or directory
FIND: `:': No such file or directory
</code></pre>
| 6,151 | 2,759,759 | 2017-07-10 15:19:19 | 19,644,032 | 11 | 2013-10-28 20:02:38 | 388,389 | 2017-07-10 15:19:19 | https://stackoverflow.com/q/19642548 | https://stackoverflow.com/a/19644032 | <p>try with :</p>
<p><code>FINDSTR /R /N "^.*$" test.txt | %windir%\system32\FIND.exe /C ":"</code></p>
<p>Meanwhile with: </p>
<p><code>for %f in (find.exe) do @echo %~dpfnx$PATH:f</code></p>
<p>(double <code>%</code> for batch file) you can see which <code>FIND.EXE</code> will be executed.</p>
| <p>try with :</p> <p><code>FINDSTR /R /N "^.*$" test.txt | %windir%\system32\FIND.exe /C ":"</code></p> <p>Meanwhile with: </p> <p><code>for %f in (find.exe) do @echo %~dpfnx$PATH:f</code></p> <p>(double <code>%</code> for batch file) you can see which <code>FIND.EXE</code> will be executed.</p> | 7002, 10193, 21229 | batch-file, find, findstr | <h1>batch find command not working</h1>
<p>does anyone know why this would not work (Windows 7, batch script)?</p>
<pre><code>C:\testing>FINDSTR /R /N "^.*$" test.txt | FIND /C ":"
FIND: `/C': No such file or directory
FIND: `:': No such file or directory
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,628 | cmd | # batch find command not working
does anyone know why this would not work (Windows 7, batch script)?
```
C:\testing>FINDSTR /R /N "^.*$" test.txt | FIND /C ":"
FIND: `/C': No such file or directory
FIND: `:': No such file or directory
``` | try with :
`FINDSTR /R /N "^.*$" test.txt | %windir%\system32\FIND.exe /C ":"`
Meanwhile with:
`for %f in (find.exe) do @echo %~dpfnx$PATH:f`
(double `%` for batch file) you can see which `FIND.EXE` will be executed. |
15473015 | Start process as limited user from elevated script | 7 | 2013-03-18 09:07:47 | <p>I have an elevated console running some bat files. Having this console running in elevated mode is mandatory for it to be able to perform some tasks like managing network shares, etc without asking for permissions. But sometimes the scripts also have to launch some applications which are not desired to run elevated.... | 4,720 | 1,670,956 | 2013-03-19 22:33:04 | 15,511,805 | 11 | 2013-03-19 22:33:04 | 1,670,956 | 2013-03-19 22:33:04 | https://stackoverflow.com/q/15473015 | https://stackoverflow.com/a/15511805 | <p><strong>The built-in Windows way</strong>: <code>START RUNAS ...</code> allows you to run a process as limited user. Here's an example:</p>
<pre><code>runas /trustlevel:0x20000 cmd.exe
</code></pre>
<p>Anyway, there are some internal differences between the execution permissions on a process executed that way and ... | <p><strong>The built-in Windows way</strong>: <code>START RUNAS ...</code> allows you to run a process as limited user. Here's an example:</p> <pre><code>runas /trustlevel:0x20000 cmd.exe </code></pre> <p>Anyway, there are some internal differences between the execution permissions on a process executed that way and ... | 488, 1980, 5940, 7002, 8891 | batch-file, console, elevation, process-elevation, uac | <h1>Start process as limited user from elevated script</h1>
<p>I have an elevated console running some bat files. Having this console running in elevated mode is mandatory for it to be able to perform some tasks like managing network shares, etc without asking for permissions. But sometimes the scripts also have to lau... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,629 | cmd | # Start process as limited user from elevated script
I have an elevated console running some bat files. Having this console running in elevated mode is mandatory for it to be able to perform some tasks like managing network shares, etc without asking for permissions. But sometimes the scripts also have to launch some ... | **The built-in Windows way**: `START RUNAS ...` allows you to run a process as limited user. Here's an example:
```
runas /trustlevel:0x20000 cmd.exe
```
Anyway, there are some internal differences between the execution permissions on a process executed that way and another started from the UI with UAC enabled (explo... |
14969399 | How to reset environment after running vcvars32.bat | 7 | 2013-02-19 23:14:05 | <p>I'm writing a batch file to run some builds using Visual C++. I would like to "undo" the vsvars32.bat/vcvarsXX.bat changes at the end of the script so that I leave the environment unchanged from before the script ran.</p>
<p>Example 1 - using vsvars32.bat</p>
<pre><code>call %VS100COMNTOOLS%vsvars32.bat
devenv myP... | 3,147 | 1,457,115 | 2013-11-26 13:12:22 | 14,970,470 | 11 | 2013-02-20 00:54:10 | 1,012,053 | 2013-02-20 00:54:10 | https://stackoverflow.com/q/14969399 | https://stackoverflow.com/a/14970470 | <p>The solution is simple - SETLOCAL coupled with ENDLOCAL. Type <code>HELP SETLOCAL</code> or <code>HELP ENDLOCAL</code> to get more info on usage.</p>
<p>Example 1:</p>
<pre><code>setlocal
call %VS100COMNTOOLS%vsvars32.bat
devenv myProject.sln /Build "Debug|Win32"
endlocal
</code></pre>
<p>Example 2:</p>
<pre><co... | <p>The solution is simple - SETLOCAL coupled with ENDLOCAL. Type <code>HELP SETLOCAL</code> or <code>HELP ENDLOCAL</code> to get more info on usage.</p> <p>Example 1:</p> <pre><code>setlocal call %VS100COMNTOOLS%vsvars32.bat devenv myProject.sln /Build "Debug|Win32" endlocal </code></pre> <p>Example 2:</p> <pre><co... | 1231, 7002, 34469 | batch-file, command-line, visual-c++ | <h1>How to reset environment after running vcvars32.bat</h1>
<p>I'm writing a batch file to run some builds using Visual C++. I would like to "undo" the vsvars32.bat/vcvarsXX.bat changes at the end of the script so that I leave the environment unchanged from before the script ran.</p>
<p>Example 1 - using vsvars32.bat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,630 | cmd | # How to reset environment after running vcvars32.bat
I'm writing a batch file to run some builds using Visual C++. I would like to "undo" the vsvars32.bat/vcvarsXX.bat changes at the end of the script so that I leave the environment unchanged from before the script ran.
Example 1 - using vsvars32.bat
```
call %VS10... | The solution is simple - SETLOCAL coupled with ENDLOCAL. Type `HELP SETLOCAL` or `HELP ENDLOCAL` to get more info on usage.
Example 1:
```
setlocal
call %VS100COMNTOOLS%vsvars32.bat
devenv myProject.sln /Build "Debug|Win32"
endlocal
```
Example 2:
```
setlocal
<path to VC bin>vcvars32.bat
:: cmd line build calls fo... |
14265984 | Windows batch file only keeping the last 30 files | 7 | 2013-01-10 19:43:23 | <p>I have written a batch file that does the following:</p>
<pre><code>REM @ECHO OFF
rem %1 = coid
rem %2 = rpg location with ending /
rem get the path of this cmd script
SET SUBDIR=%~dp0
SET BKUPDIR=%SUBDIR%BACKUPS\
SET LOGFILE=%BKUPDIR%backup.log
ECHO ************************************************* >>%LOG... | 5,006 | 302,613 | 2013-01-10 21:24:59 | 14,267,137 | 11 | 2013-01-10 20:56:47 | 891,976 | 2013-01-10 20:56:47 | https://stackoverflow.com/q/14265984 | https://stackoverflow.com/a/14267137 | <p>This will list the .zip files from newest to oldest (by creation date), skipping the first 30 files.</p>
<pre><code>for /f "skip=30 delims=" %%A in ('dir /a:-d /b /o:-d /t:c *.zip ^2^>nul') do if exist "%%~fA" echo "%%~fA"
</code></pre>
<p>Just change the <code>echo</code> to <code>del</code> when you want to a... | <p>This will list the .zip files from newest to oldest (by creation date), skipping the first 30 files.</p> <pre><code>for /f "skip=30 delims=" %%A in ('dir /a:-d /b /o:-d /t:c *.zip ^2^>nul') do if exist "%%~fA" echo "%%~fA" </code></pre> <p>Just change the <code>echo</code> to <code>del</code> when you want to a... | 64, 7002 | batch-file, windows | <h1>Windows batch file only keeping the last 30 files</h1>
<p>I have written a batch file that does the following:</p>
<pre><code>REM @ECHO OFF
rem %1 = coid
rem %2 = rpg location with ending /
rem get the path of this cmd script
SET SUBDIR=%~dp0
SET BKUPDIR=%SUBDIR%BACKUPS\
SET LOGFILE=%BKUPDIR%backup.log
ECHO ***... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,631 | cmd | # Windows batch file only keeping the last 30 files
I have written a batch file that does the following:
```
REM @ECHO OFF
rem %1 = coid
rem %2 = rpg location with ending /
rem get the path of this cmd script
SET SUBDIR=%~dp0
SET BKUPDIR=%SUBDIR%BACKUPS\
SET LOGFILE=%BKUPDIR%backup.log
ECHO ***********************... | This will list the .zip files from newest to oldest (by creation date), skipping the first 30 files.
```
for /f "skip=30 delims=" %%A in ('dir /a:-d /b /o:-d /t:c *.zip ^2^>nul') do if exist "%%~fA" echo "%%~fA"
```
Just change the `echo` to `del` when you want to actually delete the files. **`:)`** |
13734726 | Windows batch FOR command tab delimiter | 7 | 2012-12-05 23:54:22 | <p>I'm trying to use the Windows batch <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/for.mspx?mfr=true" rel="noreferrer">FOR command</a>.</p>
<p>How do I specify a TAB character as a delimiter? The default is space and tab, but I want tab only.</p>
<p>I've tried this, but it ... | 46,015 | 624,900 | 2014-01-28 20:40:42 | 13,736,048 | 11 | 2012-12-06 02:33:43 | 1,012,053 | 2012-12-06 02:33:43 | https://stackoverflow.com/q/13734726 | https://stackoverflow.com/a/13736048 | <p>You need a literal tab character in the quoted options string. The literal TAB works both in a batch file and on the command line.</p>
<p>If you are attempting to type a TAB into the command line, then file name completion may be thwarting your efforts. You can disable name completion by using <code>CMD /F:OFF</cod... | <p>You need a literal tab character in the quoted options string. The literal TAB works both in a batch file and on the command line.</p> <p>If you are attempting to type a TAB into the command line, then file name completion may be thwarting your efforts. You can disable name completion by using <code>CMD /F:OFF</cod... | 64, 7002, 9938 | batch-file, command-prompt, windows | <h1>Windows batch FOR command tab delimiter</h1>
<p>I'm trying to use the Windows batch <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/for.mspx?mfr=true" rel="noreferrer">FOR command</a>.</p>
<p>How do I specify a TAB character as a delimiter? The default is space and tab, but ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,632 | cmd | # Windows batch FOR command tab delimiter
I'm trying to use the Windows batch [FOR command](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/for.mspx?mfr=true).
How do I specify a TAB character as a delimiter? The default is space and tab, but I want tab only.
I've tried this, but it do... | You need a literal tab character in the quoted options string. The literal TAB works both in a batch file and on the command line.
If you are attempting to type a TAB into the command line, then file name completion may be thwarting your efforts. You can disable name completion by using `CMD /F:OFF`. You will then be ... |
13130214 | How to convert a batch file stored in utf-8 to something that works via another batch file and run it | 7 | 2012-10-29 21:53:29 | <p>I have a program I use to create a batch file. My problem is that the program's output is UTF-8 so as soon as any diacritical marks like é,à,ö,Ä are in my batch file it fails.
It seems I can't figure out a way to convert my output to anything but UTF-8 in the program that creates the batch file. </p>
<p>So I was th... | 52,098 | 748,777 | 2012-11-04 16:02:09 | 13,130,305 | 11 | 2012-10-29 22:02:28 | 1,012,053 | 2012-11-04 16:02:09 | https://stackoverflow.com/q/13130214 | https://stackoverflow.com/a/13130305 | <p>You have stated you don't want to rely on the script host, but there is no native batch command that can do what you want. You are going to have to use <em>something</em> beyond pure batch. The script host is native to Windows, so I should think it would not be a problem.</p>
<p>The following <strong>UTF8toANSI.vbs... | <p>You have stated you don't want to rely on the script host, but there is no native batch command that can do what you want. You are going to have to use <em>something</em> beyond pure batch. The script host is native to Windows, so I should think it would not be a problem.</p> <p>The following <strong>UTF8toANSI.vbs... | 64, 1231, 7002 | batch-file, command-line, windows | <h1>How to convert a batch file stored in utf-8 to something that works via another batch file and run it</h1>
<p>I have a program I use to create a batch file. My problem is that the program's output is UTF-8 so as soon as any diacritical marks like é,à,ö,Ä are in my batch file it fails.
It seems I can't figure out a ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,633 | cmd | # How to convert a batch file stored in utf-8 to something that works via another batch file and run it
I have a program I use to create a batch file. My problem is that the program's output is UTF-8 so as soon as any diacritical marks like é,à,ö,Ä are in my batch file it fails.
It seems I can't figure out a way to co... | You have stated you don't want to rely on the script host, but there is no native batch command that can do what you want. You are going to have to use *something* beyond pure batch. The script host is native to Windows, so I should think it would not be a problem.
The following **UTF8toANSI.vbs** script converts UTF-... |
12655558 | Strange behavior with special characters in arguments of batch functions? | 7 | 2012-09-29 18:58:30 | <p>Suppose you run <code>test.bat "blabla,blabla,^>blabla", "blaby"</code></p>
<p>test.bat implementation:</p>
<pre><code>@SETLOCAL
@ECHO OFF
SET list=%~1
ECHO "LIST: %list%"
ECHO "ARG 1: %~1"
ECHO "ARG 2: %~2"
@ENDLOCAL
@GOTO :EOF
</code></pre>
<p>Output is as expected:</p>
<pre><code>"LIST: blabla,blabla,&g... | 4,090 | 1,548,942 | 2012-09-30 16:59:27 | 12,656,803 | 11 | 2012-09-29 21:50:36 | 1,012,053 | 2012-09-30 16:59:27 | https://stackoverflow.com/q/12655558 | https://stackoverflow.com/a/12656803 | <p>You can get the same result with your 1st batch script simply by using:</p>
<pre><code>call test.bat "blabla,blabla,^>blabla", "blaby"
</code></pre>
<p>Your problems stem from an unfortunate aspect of how batch processing parses CALL statements. It is described in phase 6 at <a href="https://stackoverflow.com/a... | <p>You can get the same result with your 1st batch script simply by using:</p> <pre><code>call test.bat "blabla,blabla,^>blabla", "blaby" </code></pre> <p>Your problems stem from an unfortunate aspect of how batch processing parses CALL statements. It is described in phase 6 at <a href="https://stackoverflow.com/a... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>Strange behavior with special characters in arguments of batch functions?</h1>
<p>Suppose you run <code>test.bat "blabla,blabla,^>blabla", "blaby"</code></p>
<p>test.bat implementation:</p>
<pre><code>@SETLOCAL
@ECHO OFF
SET list=%~1
ECHO "LIST: %list%"
ECHO "ARG 1: %~1"
ECHO "ARG 2: %~2"
@ENDLOCAL
@GOTO :E... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,634 | cmd | # Strange behavior with special characters in arguments of batch functions?
Suppose you run `test.bat "blabla,blabla,^>blabla", "blaby"`
test.bat implementation:
```
@SETLOCAL
@ECHO OFF
SET list=%~1
ECHO "LIST: %list%"
ECHO "ARG 1: %~1"
ECHO "ARG 2: %~2"
@ENDLOCAL
@GOTO :EOF
```
Output is as expected:
```
"LIST... | You can get the same result with your 1st batch script simply by using:
```
call test.bat "blabla,blabla,^>blabla", "blaby"
```
Your problems stem from an unfortunate aspect of how batch processing parses CALL statements. It is described in phase 6 at [How does the Windows Command Interpreter (CMD.EXE) parse scripts?... |
10601185 | How to append content of one textfile to another textfile using batchscript? | 7 | 2012-05-15 12:58:56 | <p>How to create a simple batchscript in windows that will take the contents of one txt file and will append it to the end of another textfile</p>
| 13,970 | 666,576 | 2012-05-15 22:20:53 | 10,601,233 | 11 | 2012-05-15 13:01:26 | 870,743 | 2012-05-15 22:20:53 | https://stackoverflow.com/q/10601185 | https://stackoverflow.com/a/10601233 | <p>The type command can be used to concatenate files. Try</p>
<pre><code>type file1.txt >> file2.txt
</code></pre>
| <p>The type command can be used to concatenate files. Try</p> <pre><code>type file1.txt >> file2.txt </code></pre> | 1469, 7002 | batch-file, text | <h1>How to append content of one textfile to another textfile using batchscript?</h1>
<p>How to create a simple batchscript in windows that will take the contents of one txt file and will append it to the end of another textfile</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,635 | cmd | # How to append content of one textfile to another textfile using batchscript?
How to create a simple batchscript in windows that will take the contents of one txt file and will append it to the end of another textfile | The type command can be used to concatenate files. Try
```
type file1.txt >> file2.txt
``` |
10072879 | How to execute one line multiple times using Windows batch file? | 7 | 2012-04-09 12:00:54 | <p>Below is my requirement.</p>
<pre><code>@echo off
cls
Set Sleep=0
:start
echo This is a loop
xx.exe yyyyy.dll /p:InputDataSource=Table:table.xml
Set /A Sleep+=1
echo DisplayingSleepvalue
echo %Sleep%
goto start
</code></pre>
<p>Here I want to execute <code>xx.exe yyyyy.dll /p:InputDataSource=Table:table.xml</code>... | 32,365 | 1,321,782 | 2021-05-09 06:26:58 | 10,072,986 | 11 | 2012-04-09 12:12:11 | 500,725 | 2012-04-09 12:12:11 | https://stackoverflow.com/q/10072879 | https://stackoverflow.com/a/10072986 | <p>Try this way:-</p>
<pre><code>@echo off
cls
Set Sleep=0
:start
if %Sleep% == 30 ( goto end )
xx.exe yyyyy.dll /p:InputDataSource=Table:table.xml
echo This is a loop
Set /A Sleep+=1
echo %Sleep%
goto start
:end
echo "am 30 now"
pause
</code></pre>
| <p>Try this way:-</p> <pre><code>@echo off cls Set Sleep=0 :start if %Sleep% == 30 ( goto end ) xx.exe yyyyy.dll /p:InputDataSource=Table:table.xml echo This is a loop Set /A Sleep+=1 echo %Sleep% goto start :end echo "am 30 now" pause </code></pre> | 7002 | batch-file | <h1>How to execute one line multiple times using Windows batch file?</h1>
<p>Below is my requirement.</p>
<pre><code>@echo off
cls
Set Sleep=0
:start
echo This is a loop
xx.exe yyyyy.dll /p:InputDataSource=Table:table.xml
Set /A Sleep+=1
echo DisplayingSleepvalue
echo %Sleep%
goto start
</code></pre>
<p>Here I want t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,636 | cmd | # How to execute one line multiple times using Windows batch file?
Below is my requirement.
```
@echo off
cls
Set Sleep=0
:start
echo This is a loop
xx.exe yyyyy.dll /p:InputDataSource=Table:table.xml
Set /A Sleep+=1
echo DisplayingSleepvalue
echo %Sleep%
goto start
```
Here I want to execute `xx.exe yyyyy.dll /p:In... | Try this way:-
```
@echo off
cls
Set Sleep=0
:start
if %Sleep% == 30 ( goto end )
xx.exe yyyyy.dll /p:InputDataSource=Table:table.xml
echo This is a loop
Set /A Sleep+=1
echo %Sleep%
goto start
:end
echo "am 30 now"
pause
``` |
9720713 | Disable command history in a windows batch file | 7 | 2012-03-15 13:31:16 | <p>Is it possible to disable command history within a batch file?</p>
<p>After calling a my.bat, the results from calls to things like <code>SET /P</code> are pushed in to the history. So if I ask my user to enter a machine name, the history now also contains that machine name.</p>
<blockquote>
<p>P:>my.bat</p>
... | 5,198 | 2,009 | 2020-09-03 23:03:23 | 9,720,984 | 11 | 2012-03-15 13:45:43 | 463,115 | 2012-03-15 13:51:01 | https://stackoverflow.com/q/9720713 | https://stackoverflow.com/a/9720984 | <p>Short answer </p>
<pre><code>doskey /reinstall
</code></pre>
<p>This erases the complete history.</p>
<p>A second way could also to start a new cmd.exe instance in your batch, this would only <em>remove</em> the history made by your <code>set/p</code> statements.</p>
<pre><code>@echo off
if "%~1"==":historySafe"... | <p>Short answer </p> <pre><code>doskey /reinstall </code></pre> <p>This erases the complete history.</p> <p>A second way could also to start a new cmd.exe instance in your batch, this would only <em>remove</em> the history made by your <code>set/p</code> statements.</p> <pre><code>@echo off if "%~1"==":historySafe"... | 64, 1231, 2631, 7002 | batch-file, cmd, command-line, windows | <h1>Disable command history in a windows batch file</h1>
<p>Is it possible to disable command history within a batch file?</p>
<p>After calling a my.bat, the results from calls to things like <code>SET /P</code> are pushed in to the history. So if I ask my user to enter a machine name, the history now also contains th... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,637 | cmd | # Disable command history in a windows batch file
Is it possible to disable command history within a batch file?
After calling a my.bat, the results from calls to things like `SET /P` are pushed in to the history. So if I ask my user to enter a machine name, the history now also contains that machine name.
> P:>my.b... | Short answer
```
doskey /reinstall
```
This erases the complete history.
A second way could also to start a new cmd.exe instance in your batch, this would only *remove* the history made by your `set/p` statements.
```
@echo off
if "%~1"==":historySafe" goto :historySafe
cmd /c "%~f0" :historySafe
exit /b
:historyS... |
6591544 | How can I convert a relative path to a fully qualified path in a DOS batch file? | 7 | 2011-07-06 04:26:10 | <p>I am writing a batch file that does a number of operations in a folder that is specified relative to the first argument passed in to the batch file. Within the batch file, I would like to echo to the user the the folder I am working in. However, every time I echo the path, it contains the ....\ that I used to dete... | 8,221 | 830,871 | 2015-02-27 21:27:36 | 6,591,601 | 11 | 2011-07-06 04:36:00 | 297,408 | 2011-07-07 04:44:39 | https://stackoverflow.com/q/6591544 | https://stackoverflow.com/a/6591601 | <pre><code>SET "TempDir=%~1\..\Temp"
CALL :normalise "%TempDir%"
ECHO %TempDir%
…
:normalise
SET "TempDir=%~f1"
GOTO :EOF
…
</code></pre>
<p>The <code>:normalise</code> subroutine uses the <code>%~f1</code> expression to transform the relative path into the complete one and store it back to <code>TempDir</code>.</p>... | <pre><code>SET "TempDir=%~1\..\Temp" CALL :normalise "%TempDir%" ECHO %TempDir% … :normalise SET "TempDir=%~f1" GOTO :EOF … </code></pre> <p>The <code>:normalise</code> subroutine uses the <code>%~f1</code> expression to transform the relative path into the complete one and store it back to <code>TempDir</code>.</p>... | 5370, 7002, 8877 | batch-file, dos, relative-path | <h1>How can I convert a relative path to a fully qualified path in a DOS batch file?</h1>
<p>I am writing a batch file that does a number of operations in a folder that is specified relative to the first argument passed in to the batch file. Within the batch file, I would like to echo to the user the the folder I am w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,638 | cmd | # How can I convert a relative path to a fully qualified path in a DOS batch file?
I am writing a batch file that does a number of operations in a folder that is specified relative to the first argument passed in to the batch file. Within the batch file, I would like to echo to the user the the folder I am working in.... | ```
SET "TempDir=%~1\..\Temp"
CALL :normalise "%TempDir%"
ECHO %TempDir%
…
:normalise
SET "TempDir=%~f1"
GOTO :EOF
…
```
The `:normalise` subroutine uses the `%~f1` expression to transform the relative path into the complete one and store it back to `TempDir`.
---
**UPDATE**
Alternatively, you could use a FOR loo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.