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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10716803 | Batch file to perform start, run, %TEMP% and delete all | 12 | 2012-05-23 09:10:19 | <p>looking for a way to perform the following:</p>
<p>Start > Run > "%TEMP% > Delete everything (skipping any conflicts).</p>
<p>so Far I have</p>
<pre><code>@echo off
start %TEMP%
DEL *.*
</code></pre>
<p>I suppose I could use CD to get to the folder, the thing I'm wondering is if there are any instances where it ... | 255,055 | 1,192,558 | 2019-10-28 06:27:39 | 10,717,043 | 34 | 2012-05-23 09:23:52 | 73,070 | 2018-03-12 08:11:55 | https://stackoverflow.com/q/10716803 | https://stackoverflow.com/a/10717043 | <p><code>del</code> won't trigger any dialogs or message boxes. You have a few problems, though:</p>
<ol>
<li><p><code>start</code> will just open Explorer which would be useless. You need <code>cd</code> to change the working directory of your batch file (the <code>/D</code> is there so it also works when run from a ... | <p><code>del</code> won't trigger any dialogs or message boxes. You have a few problems, though:</p> <ol> <li><p><code>start</code> will just open Explorer which would be useless. You need <code>cd</code> to change the working directory of your batch file (the <code>/D</code> is there so it also works when run from a ... | 7002 | batch-file | <h1>Batch file to perform start, run, %TEMP% and delete all</h1>
<p>looking for a way to perform the following:</p>
<p>Start > Run > "%TEMP% > Delete everything (skipping any conflicts).</p>
<p>so Far I have</p>
<pre><code>@echo off
start %TEMP%
DEL *.*
</code></pre>
<p>I suppose I could use CD to get to the folder... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,519 | cmd | # Batch file to perform start, run, %TEMP% and delete all
looking for a way to perform the following:
Start > Run > "%TEMP% > Delete everything (skipping any conflicts).
so Far I have
```
@echo off
start %TEMP%
DEL *.*
```
I suppose I could use CD to get to the folder, the thing I'm wondering is if there are any i... | `del` won't trigger any dialogs or message boxes. You have a few problems, though:
1. `start` will just open Explorer which would be useless. You need `cd` to change the working directory of your batch file (the `/D` is there so it also works when run from a different drive):
```
cd /D %temp%
```
2. You may ... |
21969145 | Why (or when) is Rscript (or littler) better than R CMD BATCH? | 53 | 2014-02-23 13:58:26 | <p>I am automating some webscraping with <code>R</code> in <code>cron</code> and sometimes I use <code>R CMD BATCH</code> and sometimes I use <code>Rscript</code>. </p>
<p>To decide which one to use I mainly focus if I want the <code>.Rout</code> file or not.</p>
<p>But reading the answers to some questions here in S... | 19,201 | 3,216,713 | 2020-08-25 12:05:24 | 22,358,976 | 33 | 2014-03-12 17:13:33 | 143,305 | 2015-11-05 01:13:56 | https://stackoverflow.com/q/21969145 | https://stackoverflow.com/a/22358976 | <p><code>R CMD BATCH</code> is all we had years ago. It makes i/o very hard and leaves files behind.</p>
<p>Things got better, first with littler and then too with Rscript. Both can be used for 'shebang' lines such as</p>
<pre><code> #!/usr/bin/r
#!/usr/bin/Rscript
</code></pre>
<p>and both can be used with packa... | <p><code>R CMD BATCH</code> is all we had years ago. It makes i/o very hard and leaves files behind.</p> <p>Things got better, first with littler and then too with Rscript. Both can be used for 'shebang' lines such as</p> <pre><code> #!/usr/bin/r #!/usr/bin/Rscript </code></pre> <p>and both can be used with packa... | 601, 2631, 4452, 7002, 44486 | batch-file, cmd, cron, r, rscript | <h1>Why (or when) is Rscript (or littler) better than R CMD BATCH?</h1>
<p>I am automating some webscraping with <code>R</code> in <code>cron</code> and sometimes I use <code>R CMD BATCH</code> and sometimes I use <code>Rscript</code>. </p>
<p>To decide which one to use I mainly focus if I want the <code>.Rout</code> ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,520 | cmd | # Why (or when) is Rscript (or littler) better than R CMD BATCH?
I am automating some webscraping with `R` in `cron` and sometimes I use `R CMD BATCH` and sometimes I use `Rscript`.
To decide which one to use I mainly focus if I want the `.Rout` file or not.
But reading the answers to some questions here in SO (like... | `R CMD BATCH` is all we had years ago. It makes i/o very hard and leaves files behind.
Things got better, first with littler and then too with Rscript. Both can be used for 'shebang' lines such as
```
#!/usr/bin/r
#!/usr/bin/Rscript
```
and both can be used with packages like getopt and optparse --- allowing you ... |
11074849 | Run a batch file in a new window from batch? | 39 | 2012-06-17 21:16:33 | <p>I know it seems this has been asked before, but I need a batch to open another batch in a new window. I've tried:</p>
<pre><code>start abc.bat
cmd abc.bat
run abc.bat
</code></pre>
<p>and others. They've all opened in the same window or just opened Command Prompt in new window, ignoring my batch. Is there a batc... | 114,414 | 1,452,838 | 2020-06-11 13:06:05 | 11,074,898 | 33 | 2012-06-17 21:24:41 | 458,741 | 2012-06-17 21:24:41 | https://stackoverflow.com/q/11074849 | https://stackoverflow.com/a/11074898 | <p>It's a little bit strange that <code>start abc.bat</code> doesn't work but I assume this is because you are running this in the middle of another batch. You probably need <code>call</code>:</p>
<pre><code>22:22:38.85 c:\help call
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]
... | <p>It's a little bit strange that <code>start abc.bat</code> doesn't work but I assume this is because you are running this in the middle of another batch. You probably need <code>call</code>:</p> <pre><code>22:22:38.85 c:\help call Calls one batch program from another. CALL [drive:][path]filename [batch-parameters] ... | 1796, 4963, 7002 | batch-file, command, window | <h1>Run a batch file in a new window from batch?</h1>
<p>I know it seems this has been asked before, but I need a batch to open another batch in a new window. I've tried:</p>
<pre><code>start abc.bat
cmd abc.bat
run abc.bat
</code></pre>
<p>and others. They've all opened in the same window or just opened Command Pr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,521 | cmd | # Run a batch file in a new window from batch?
I know it seems this has been asked before, but I need a batch to open another batch in a new window. I've tried:
```
start abc.bat
cmd abc.bat
run abc.bat
```
and others. They've all opened in the same window or just opened Command Prompt in new window, ignoring my b... | It's a little bit strange that `start abc.bat` doesn't work but I assume this is because you are running this in the middle of another batch. You probably need `call`:
```
22:22:38.85 c:\help call
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]
```
Giving you `start call abc.bat`... |
3942265 | Errorlevel in a For loop (Windows batch) | 31 | 2010-10-15 12:37:32 | <p>I have the following windows batch code:</p>
<pre><code>for %%i in (iidbms iigcc iigcd dmfacp dmfrcp rmcmd qwerty) do (
tasklist | findstr /i %%i
echo %errorlevel%
if %errorlevel% == 0 (echo %%i ok process found %errorlevel%)
if %errorlevel% == 1 (echo %%i no process found %errorlevel%)
)
</code></pre>
<p>... | 43,746 | null | 2022-08-21 15:20:41 | 3,942,468 | 33 | 2010-10-15 13:04:37 | 35,501 | 2022-08-21 15:20:16 | https://stackoverflow.com/q/3942265 | https://stackoverflow.com/a/3942468 | <p>IF ERRORLEVEL returns TRUE if the return code was equal to or higher than the specified errorlevel. In your example, since 0 is lower than 1, the first errorlevel statement will always be true if the actual error code is 0 or above. What you want is to test for errorlevel 1 first.</p>
<p>E.g.:</p>
<pre><code>for %%i... | <p>IF ERRORLEVEL returns TRUE if the return code was equal to or higher than the specified errorlevel. In your example, since 0 is lower than 1, the first errorlevel statement will always be true if the actual error code is 0 or above. What you want is to test for errorlevel 1 first.</p> <p>E.g.:</p> <pre><code>for %%i... | 64, 7002, 17564 | batch-file, errorlevel, windows | <h1>Errorlevel in a For loop (Windows batch)</h1>
<p>I have the following windows batch code:</p>
<pre><code>for %%i in (iidbms iigcc iigcd dmfacp dmfrcp rmcmd qwerty) do (
tasklist | findstr /i %%i
echo %errorlevel%
if %errorlevel% == 0 (echo %%i ok process found %errorlevel%)
if %errorlevel% == 1 (echo %%i n... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,522 | cmd | # Errorlevel in a For loop (Windows batch)
I have the following windows batch code:
```
for %%i in (iidbms iigcc iigcd dmfacp dmfrcp rmcmd qwerty) do (
tasklist | findstr /i %%i
echo %errorlevel%
if %errorlevel% == 0 (echo %%i ok process found %errorlevel%)
if %errorlevel% == 1 (echo %%i no process found %err... | IF ERRORLEVEL returns TRUE if the return code was equal to or higher than the specified errorlevel. In your example, since 0 is lower than 1, the first errorlevel statement will always be true if the actual error code is 0 or above. What you want is to test for errorlevel 1 first.
E.g.:
```
for %%i in (iidbms iigcc i... |
13599822 | Command prompt gets stuck and continues on enter key press | 28 | 2012-11-28 07:19:49 | <p>Does anyone come across a scenario when the command prompt is running a process and then it gets stuck and the process is also sleeping.
Then when we press <kbd>Enter</kbd> key in the cmd window the process continues.</p>
<p>Is there any way to avoid this?
or can this be handled??</p>
| 28,251 | 1,356,126 | 2022-08-25 12:42:08 | 62,164,553 | 33 | 2020-06-03 03:06:27 | 995,714 | 2020-09-27 00:23:56 | https://stackoverflow.com/q/13599822 | https://stackoverflow.com/a/62164553 | <p>The other answers are wrong! The Windows console has a separate mode called "mark mode" for selecting text. In that mode the screen will be frozen, texts will go into the buffer and if the buffer is full the running process will be blocked</p>
<p><a href="https://i.sstatic.net/T2J9D.png" rel="noreferrer"><... | <p>The other answers are wrong! The Windows console has a separate mode called "mark mode" for selecting text. In that mode the screen will be frozen, texts will go into the buffer and if the buffer is full the running process will be blocked</p> <p><a href="https://i.sstatic.net/T2J9D.png" rel="noreferrer"><... | 64, 488, 2631 | cmd, console, windows | <h1>Command prompt gets stuck and continues on enter key press</h1>
<p>Does anyone come across a scenario when the command prompt is running a process and then it gets stuck and the process is also sleeping.
Then when we press <kbd>Enter</kbd> key in the cmd window the process continues.</p>
<p>Is there any way to avo... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,524 | cmd | # Command prompt gets stuck and continues on enter key press
Does anyone come across a scenario when the command prompt is running a process and then it gets stuck and the process is also sleeping.
Then when we press `Enter` key in the cmd window the process continues.
Is there any way to avoid this?
or can this be h... | The other answers are wrong! The Windows console has a separate mode called "mark mode" for selecting text. In that mode the screen will be frozen, texts will go into the buffer and if the buffer is full the running process will be blocked
[](https://i.sstatic.net/T2J9D.png... |
14531917 | Launch Minecraft from command line - username and password as prefix | 28 | 2013-01-25 23:24:16 | <p>I'm trying to make a simple custom Minecraft launcher.</p>
<p>According to <a href="http://www.minecraft.wiki/w/Minecraft_Launcher" rel="nofollow noreferrer">the Minecraft Wiki page for the Launcher</a>,
it should be possible to run the Minecraft launcher using username and password prefixes from the command line an... | 204,600 | 1,578,823 | 2024-04-29 00:20:04 | 15,562,373 | 33 | 2013-03-22 03:44:51 | 1,191,610 | 2021-01-27 10:05:53 | https://stackoverflow.com/q/14531917 | https://stackoverflow.com/a/15562373 | <p>You <strong>can</strong> do this, you just need to circumvent the launcher.</p>
<p>In <code>%appdata%\.minecraft\bin</code> (or <code>~/.minecraft/bin</code> on unixy systems), there is a minecraft.jar file. This is the actual game - the launcher runs this.</p>
<p>Invoke it like so:</p>
<pre><code>java -Xms512m -Xmx... | <p>You <strong>can</strong> do this, you just need to circumvent the launcher.</p> <p>In <code>%appdata%\.minecraft\bin</code> (or <code>~/.minecraft/bin</code> on unixy systems), there is a minecraft.jar file. This is the actual game - the launcher runs this.</p> <p>Invoke it like so:</p> <pre><code>java -Xms512m -Xmx... | 17, 391, 2631, 7571, 62048 | cmd, java, launcher, minecraft, terminal | <h1>Launch Minecraft from command line - username and password as prefix</h1>
<p>I'm trying to make a simple custom Minecraft launcher.</p>
<p>According to <a href="http://www.minecraft.wiki/w/Minecraft_Launcher" rel="nofollow noreferrer">the Minecraft Wiki page for the Launcher</a>,
it should be possible to run the Mi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,525 | cmd | # Launch Minecraft from command line - username and password as prefix
I'm trying to make a simple custom Minecraft launcher.
According to [the Minecraft Wiki page for the Launcher](http://www.minecraft.wiki/w/Minecraft_Launcher),
it should be possible to run the Minecraft launcher using username and password prefixe... | You **can** do this, you just need to circumvent the launcher.
In `%appdata%\.minecraft\bin` (or `~/.minecraft/bin` on unixy systems), there is a minecraft.jar file. This is the actual game - the launcher runs this.
Invoke it like so:
```
java -Xms512m -Xmx1g -Djava.library.path=natives/ -cp "minecraft.jar;lwjgl.jar... |
6860691 | using JDBC preparedStatement in a batch | 27 | 2011-07-28 14:31:18 | <p>Im using <code>Statement</code>s batchs to query my data base.
Iv'e done some research now and i want to rewrite my application to use <code>preparedStatement</code> instead but i'm having hard time to figure out how to add queries to a <code>preparedStatement</code> batch.</p>
<p>This is what i'm doing now:</p>
... | 73,846 | 688,193 | 2017-10-11 09:09:24 | 6,860,771 | 33 | 2011-07-28 14:36:21 | 193,906 | 2013-01-22 10:35:03 | https://stackoverflow.com/q/6860691 | https://stackoverflow.com/a/6860771 | <p>Read the <a href="http://download.oracle.com/javase/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame6.html">section 6.1.2 of this document</a> for examples. Basically you use the same statement object and invoke the batch method after all the placeholders are set. <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v8/i... | <p>Read the <a href="http://download.oracle.com/javase/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame6.html">section 6.1.2 of this document</a> for examples. Basically you use the same statement object and invoke the batch method after all the placeholders are set. <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v8/i... | 17, 5617, 7002, 10898 | batch-file, java, jdbc, prepared-statement | <h1>using JDBC preparedStatement in a batch</h1>
<p>Im using <code>Statement</code>s batchs to query my data base.
Iv'e done some research now and i want to rewrite my application to use <code>preparedStatement</code> instead but i'm having hard time to figure out how to add queries to a <code>preparedStatement</code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,526 | cmd | # using JDBC preparedStatement in a batch
Im using `Statement`s batchs to query my data base.
Iv'e done some research now and i want to rewrite my application to use `preparedStatement` instead but i'm having hard time to figure out how to add queries to a `preparedStatement` batch.
This is what i'm doing now:
```
p... | Read the [section 6.1.2 of this document](http://download.oracle.com/javase/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame6.html) for examples. Basically you use the same statement object and invoke the batch method after all the placeholders are set. [Another IBM DB2 example](http://publib.boulder.ibm.com/infocenter/db2luw/v... |
10354016 | File redirection in Windows and %errorlevel% | 26 | 2012-04-27 16:03:20 | <p>Lets say we want to create an empty file in windows with the following command:</p>
<pre><code>type nul > C:\does\not\exist\file.txt
</code></pre>
<p>the directory does not exist, so we get the error:</p>
<pre><code>The system cannot find the path specified
</code></pre>
<p>If you print out the <code>%errorle... | 9,518 | 517,358 | 2020-05-30 21:00:03 | 10,358,437 | 33 | 2012-04-27 22:02:18 | 1,012,053 | 2017-08-13 03:26:00 | https://stackoverflow.com/q/10354016 | https://stackoverflow.com/a/10358437 | <p>You can use the following:</p>
<pre><code>C:\>type nul > C:\does\not\exist\file.txt && echo ok || echo fail
The system cannot find the path specified.
fail
C:\>echo %errorlevel%
1
</code></pre>
<p>I always assumed the && and || operators used ERRORLEVEL, but apparently not.</p>
<p>Very c... | <p>You can use the following:</p> <pre><code>C:\>type nul > C:\does\not\exist\file.txt && echo ok || echo fail The system cannot find the path specified. fail C:\>echo %errorlevel% 1 </code></pre> <p>I always assumed the && and || operators used ERRORLEVEL, but apparently not.</p> <p>Very c... | 64, 379, 7002, 26698 | batch-file, error-handling, io-redirection, windows | <h1>File redirection in Windows and %errorlevel%</h1>
<p>Lets say we want to create an empty file in windows with the following command:</p>
<pre><code>type nul > C:\does\not\exist\file.txt
</code></pre>
<p>the directory does not exist, so we get the error:</p>
<pre><code>The system cannot find the path specified... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,527 | cmd | # File redirection in Windows and %errorlevel%
Lets say we want to create an empty file in windows with the following command:
```
type nul > C:\does\not\exist\file.txt
```
the directory does not exist, so we get the error:
```
The system cannot find the path specified
```
If you print out the `%errorlevel%` the o... | You can use the following:
```
C:\>type nul > C:\does\not\exist\file.txt && echo ok || echo fail
The system cannot find the path specified.
fail
C:\>echo %errorlevel%
1
```
I always assumed the && and || operators used ERRORLEVEL, but apparently not.
Very curious that ERRORLEVEL is set after redirection error only ... |
7883169 | How to escape variables with parentheses inside if-clause in a batch file? | 26 | 2011-10-19 18:57:01 | <p>Running this batch file</p>
<pre><code>@echo off
set a=some value with (parentheses) inside
if 1 == 1 (
set PATH=%a%
)
</code></pre>
<p>gives <code>inside was unexpected at this time.</code> error.</p>
<p>How to escape <code>a</code> variable to avoid this error?</p>
| 25,021 | 95,735 | 2015-10-14 13:31:49 | 7,886,505 | 33 | 2011-10-25 08:19:59 | 463,115 | 2015-10-14 13:31:49 | https://stackoverflow.com/q/7883169 | https://stackoverflow.com/a/7886505 | <p>You can use two different ways</p>
<p>Use the extended syntax of <code>set</code> with quotes <code>set "var=content"</code> will set var with content,
content is quoted so special characters aren't problematic and it uses the content till the last quote (without the quote itself)</p>
<pre><code>@echo off
set a=so... | <p>You can use two different ways</p> <p>Use the extended syntax of <code>set</code> with quotes <code>set "var=content"</code> will set var with content, content is quoted so special characters aren't problematic and it uses the content till the last quote (without the quote itself)</p> <pre><code>@echo off set a=so... | 64, 1231, 4804, 7002 | batch-file, command-line, escaping, windows | <h1>How to escape variables with parentheses inside if-clause in a batch file?</h1>
<p>Running this batch file</p>
<pre><code>@echo off
set a=some value with (parentheses) inside
if 1 == 1 (
set PATH=%a%
)
</code></pre>
<p>gives <code>inside was unexpected at this time.</code> error.</p>
<p>How to escape <code>a... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,528 | cmd | # How to escape variables with parentheses inside if-clause in a batch file?
Running this batch file
```
@echo off
set a=some value with (parentheses) inside
if 1 == 1 (
set PATH=%a%
)
```
gives `inside was unexpected at this time.` error.
How to escape `a` variable to avoid this error? | You can use two different ways
Use the extended syntax of `set` with quotes `set "var=content"` will set var with content,
content is quoted so special characters aren't problematic and it uses the content till the last quote (without the quote itself)
```
@echo off
set a=some value with (parentheses) inside
if 1 == ... |
7126789 | VIM, Run a command on multiple files | 26 | 2011-08-19 20:02:17 | <p>I have a bunch of sass files and my designer used the wrong syntax. I wanted <code>:margin-top 1px</code> but he did <code>margin-top: 1px</code></p>
<p>So I easily wrote a sub command:</p>
<pre><code>:rubydo sub! /([\w-]+):/,':\1'
</code></pre>
<p>So that works and fixes all the colons and moves them in the plac... | 13,509 | 618,380 | 2014-09-17 11:48:38 | 7,133,233 | 33 | 2011-08-20 16:53:50 | 152,016 | 2011-08-20 16:53:50 | https://stackoverflow.com/q/7126789 | https://stackoverflow.com/a/7133233 | <p>See this: <a href="http://vimdoc.sourceforge.net/htmldoc/editing.html#:argdo" rel="noreferrer">http://vimdoc.sourceforge.net/htmldoc/editing.html#:argdo</a></p>
<p>I learned this command right now, but the help is clear.</p>
<p>Go for:</p>
<pre><code>:args *.css
:argdo %s/\([[:alpha:]-]\+\):/:\1/ge | update
</cod... | <p>See this: <a href="http://vimdoc.sourceforge.net/htmldoc/editing.html#:argdo" rel="noreferrer">http://vimdoc.sourceforge.net/htmldoc/editing.html#:argdo</a></p> <p>I learned this command right now, but the help is clear.</p> <p>Go for:</p> <pre><code>:args *.css :argdo %s/\([[:alpha:]-]\+\):/:\1/ge | update </cod... | 370, 7002, 16107 | batch-file, substitution, vim | <h1>VIM, Run a command on multiple files</h1>
<p>I have a bunch of sass files and my designer used the wrong syntax. I wanted <code>:margin-top 1px</code> but he did <code>margin-top: 1px</code></p>
<p>So I easily wrote a sub command:</p>
<pre><code>:rubydo sub! /([\w-]+):/,':\1'
</code></pre>
<p>So that works and f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,529 | cmd | # VIM, Run a command on multiple files
I have a bunch of sass files and my designer used the wrong syntax. I wanted `:margin-top 1px` but he did `margin-top: 1px`
So I easily wrote a sub command:
```
:rubydo sub! /([\w-]+):/,':\1'
```
So that works and fixes all the colons and moves them in the place I want. I have... | See this: <http://vimdoc.sourceforge.net/htmldoc/editing.html#:argdo>
I learned this command right now, but the help is clear.
Go for:
```
:args *.css
:argdo %s/\([[:alpha:]-]\+\):/:\1/ge | update
``` |
289498 | Running Batch File in background when windows boots up | 26 | 2008-11-14 08:25:56 | <p>How do I run a batch file each time windows boots up also I need to run it in the back ground(without that command window getting displayed)? I use Windows Xp.
My actuall requirement is I want to start the Tracd server using the command line commands whenever Windows boots up.</p>
| 89,422 | 13,440 | 2025-04-06 02:18:02 | 289,500 | 33 | 2008-11-14 08:29:22 | 6,309 | 2011-12-22 21:56:19 | https://stackoverflow.com/q/289498 | https://stackoverflow.com/a/289500 | <p>Add your program in the <a href="http://www.bleepingcomputer.com/tutorials/tutorial44.html" rel="noreferrer">registry</a>:</p>
<p>Run - These are the most common startup locations for programs to install auto start from. By default these keys are not executed in Safe mode. If you prefix the value of these keys with... | <p>Add your program in the <a href="http://www.bleepingcomputer.com/tutorials/tutorial44.html" rel="noreferrer">registry</a>:</p> <p>Run - These are the most common startup locations for programs to install auto start from. By default these keys are not executed in Safe mode. If you prefix the value of these keys with... | 64, 7002, 7457, 14705 | batch-file, startup, tracd, windows | <h1>Running Batch File in background when windows boots up</h1>
<p>How do I run a batch file each time windows boots up also I need to run it in the back ground(without that command window getting displayed)? I use Windows Xp.
My actuall requirement is I want to start the Tracd server using the command line commands wh... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,530 | cmd | # Running Batch File in background when windows boots up
How do I run a batch file each time windows boots up also I need to run it in the back ground(without that command window getting displayed)? I use Windows Xp.
My actuall requirement is I want to start the Tracd server using the command line commands whenever Wi... | Add your program in the [registry](http://www.bleepingcomputer.com/tutorials/tutorial44.html):
Run - These are the most common startup locations for programs to install auto start from. By default these keys are not executed in Safe mode. If you prefix the value of these keys with an asterisk, *, is will run in Safe M... |
27595440 | How to pass variables from one batch file to another batch file? | 25 | 2014-12-22 01:06:47 | <p>How do I write a batch file which gets an input variable and sends it to another batch file to be processed.</p>
<p><strong>Batch 1</strong></p>
<p>I don't know how to send a variable to batch 2 which is my problem here.</p>
<p><strong>Batch 2</strong> </p>
<pre><code>if %variable%==1 goto Example
goto :EOF
:E... | 63,658 | 4,206,463 | 2023-01-27 08:27:11 | 48,264,867 | 33 | 2018-01-15 14:19:23 | 3,070,485 | 2018-01-17 09:58:15 | https://stackoverflow.com/q/27595440 | https://stackoverflow.com/a/48264867 | <p>You don't need to do anything at all. Variables set in a batch file are visible in a batch file that it calls.</p>
<p>Example</p>
<h1>test1.bat</h1>
<pre><code>@echo off
set x=7
call test2.bat
set x=3
call test2.bat
pause
</code></pre>
<h1>test2.bat</h1>
<pre><code>echo In test2.bat with x = %x%.
</code></pre>
... | <p>You don't need to do anything at all. Variables set in a batch file are visible in a batch file that it calls.</p> <p>Example</p> <h1>test1.bat</h1> <pre><code>@echo off set x=7 call test2.bat set x=3 call test2.bat pause </code></pre> <h1>test2.bat</h1> <pre><code>echo In test2.bat with x = %x%. </code></pre> ... | 7002 | batch-file | <h1>How to pass variables from one batch file to another batch file?</h1>
<p>How do I write a batch file which gets an input variable and sends it to another batch file to be processed.</p>
<p><strong>Batch 1</strong></p>
<p>I don't know how to send a variable to batch 2 which is my problem here.</p>
<p><strong>Batc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,531 | cmd | # How to pass variables from one batch file to another batch file?
How do I write a batch file which gets an input variable and sends it to another batch file to be processed.
**Batch 1**
I don't know how to send a variable to batch 2 which is my problem here.
**Batch 2**
```
if %variable%==1 goto Example
goto :EO... | You don't need to do anything at all. Variables set in a batch file are visible in a batch file that it calls.
Example
# test1.bat
```
@echo off
set x=7
call test2.bat
set x=3
call test2.bat
pause
```
# test2.bat
```
echo In test2.bat with x = %x%.
```
# Output
... when test1.bat runs.
```
In test2.bat with x =... |
4673714 | How to execute several batch commands in sequence | 24 | 2011-01-12 20:31:40 | <p>I want to create a Windows XP batch script that sequentially performs something like the following:</p>
<pre><code>@echo off
:: build everything
cd \workspace\project1
mvn clean install
cd ..\project2
mvn clean install
:: run some java file
cd \workspace\project3
java -jar somefile.jar
</code></pre>
<p>When I cre... | 34,538 | 281,891 | 2011-01-12 20:56:44 | 4,673,780 | 33 | 2011-01-12 20:39:30 | 237,993 | 2011-01-12 20:56:44 | https://stackoverflow.com/q/4673714 | https://stackoverflow.com/a/4673780 | <p>I think your problem is that when you invoke <code>mvn</code> command you never go back to your script again.</p>
<p>Try using the <a href="http://www.robvanderwoude.com/call.php" rel="noreferrer"><code>call</code></a> command e.g.:</p>
<pre><code>call mvn clean install
</code></pre>
<p>This will invoke <code>mvn... | <p>I think your problem is that when you invoke <code>mvn</code> command you never go back to your script again.</p> <p>Try using the <a href="http://www.robvanderwoude.com/call.php" rel="noreferrer"><code>call</code></a> command e.g.:</p> <pre><code>call mvn clean install </code></pre> <p>This will invoke <code>mvn... | 2631, 7002 | batch-file, cmd | <h1>How to execute several batch commands in sequence</h1>
<p>I want to create a Windows XP batch script that sequentially performs something like the following:</p>
<pre><code>@echo off
:: build everything
cd \workspace\project1
mvn clean install
cd ..\project2
mvn clean install
:: run some java file
cd \workspace\p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,532 | cmd | # How to execute several batch commands in sequence
I want to create a Windows XP batch script that sequentially performs something like the following:
```
@echo off
:: build everything
cd \workspace\project1
mvn clean install
cd ..\project2
mvn clean install
:: run some java file
cd \workspace\project3
java -jar so... | I think your problem is that when you invoke `mvn` command you never go back to your script again.
Try using the [`call`](http://www.robvanderwoude.com/call.php) command e.g.:
```
call mvn clean install
```
This will invoke `mvn clean install` command and then return back to your script.
When you simply invoke `mvn... |
6907159 | Windows Batch Copy file by filename | 23 | 2011-08-02 04:12:36 | <p>The file I want to copy is located in "C:\Report\" and the filename I want to copy is something like "rptXXXX.txt".
What I want to do is write a batch that copy the file that the filename is start with "rpt".</p>
<p>The destination folder is "F:\Project\Report\".</p>
| 76,037 | 868,702 | 2016-12-22 12:46:01 | 6,907,177 | 33 | 2011-08-02 04:17:17 | 826,455 | 2011-08-02 04:17:17 | https://stackoverflow.com/q/6907159 | https://stackoverflow.com/a/6907177 | <p>This should work, you can use an * as a wildcard:</p>
<pre><code>xcopy e:\foo\rpt*.txt e:\foo2
</code></pre>
<p>or in your case,</p>
<pre><code>xcopy C:\Report\rpt*.txt F:\Project\Report\
</code></pre>
| <p>This should work, you can use an * as a wildcard:</p> <pre><code>xcopy e:\foo\rpt*.txt e:\foo2 </code></pre> <p>or in your case,</p> <pre><code>xcopy C:\Report\rpt*.txt F:\Project\Report\ </code></pre> | 64, 4330, 7002 | batch-file, copy, windows | <h1>Windows Batch Copy file by filename</h1>
<p>The file I want to copy is located in "C:\Report\" and the filename I want to copy is something like "rptXXXX.txt".
What I want to do is write a batch that copy the file that the filename is start with "rpt".</p>
<p>The destination folder is "F:\Project\Report\".</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,533 | cmd | # Windows Batch Copy file by filename
The file I want to copy is located in "C:\Report\" and the filename I want to copy is something like "rptXXXX.txt".
What I want to do is write a batch that copy the file that the filename is start with "rpt".
The destination folder is "F:\Project\Report\". | This should work, you can use an * as a wildcard:
```
xcopy e:\foo\rpt*.txt e:\foo2
```
or in your case,
```
xcopy C:\Report\rpt*.txt F:\Project\Report\
``` |
3680977 | Can a batch file capture the exit codes of the commands it is invoking? | 23 | 2010-09-09 22:20:57 | <p>Basically, let's say that I have a batch file that calls myapp1.exe and myapp1.exe exits with Exit Code 1. Can the batch file capture this information and either force the batch file to exit with that same exit code or perform some other logic?</p>
| 48,331 | 127,257 | 2015-09-25 10:23:35 | 3,684,034 | 33 | 2010-09-10 10:59:23 | 73,070 | 2010-09-10 10:59:23 | https://stackoverflow.com/q/3680977 | https://stackoverflow.com/a/3684034 | <pre><code>@echo off
rem ...
set errorlevel=
MyApp1.exe
exit /b %errorlevel%
</code></pre>
<p>would be the explicit variant.</p>
| <pre><code>@echo off rem ... set errorlevel= MyApp1.exe exit /b %errorlevel% </code></pre> <p>would be the explicit variant.</p> | 7002, 10021 | batch-file, exit-code | <h1>Can a batch file capture the exit codes of the commands it is invoking?</h1>
<p>Basically, let's say that I have a batch file that calls myapp1.exe and myapp1.exe exits with Exit Code 1. Can the batch file capture this information and either force the batch file to exit with that same exit code or perform some othe... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,534 | cmd | # Can a batch file capture the exit codes of the commands it is invoking?
Basically, let's say that I have a batch file that calls myapp1.exe and myapp1.exe exits with Exit Code 1. Can the batch file capture this information and either force the batch file to exit with that same exit code or perform some other logic? | ```
@echo off
rem ...
set errorlevel=
MyApp1.exe
exit /b %errorlevel%
```
would be the explicit variant. |
41639740 | Running Python file by double-click | 22 | 2017-01-13 16:58:05 | <p>I have really annoying problem, I cannot run a Python file just by double-clicking.</p>
<p>I have tried to set it to open the file with <code>idle.bat</code> but that only starts IDLE editor on double-click, it does not run the Python file.</p>
| 102,817 | 7,215,755 | 2023-10-10 10:22:20 | 41,639,832 | 33 | 2017-01-13 17:04:00 | 384,954 | 2017-01-13 18:01:46 | https://stackoverflow.com/q/41639740 | https://stackoverflow.com/a/41639832 | <p>What version of Python do you have installed?</p>
<p>You should write your own batch file to execute your python binary and your script.</p>
<p>For example, with a default Python 2.7 installation on Windows, this could be the entire contents of your script.</p>
<p><code>myscript.bat</code>:</p>
<pre><code>ECHO O... | <p>What version of Python do you have installed?</p> <p>You should write your own batch file to execute your python binary and your script.</p> <p>For example, with a default Python 2.7 installation on Windows, this could be the entire contents of your script.</p> <p><code>myscript.bat</code>:</p> <pre><code>ECHO O... | 16, 7002, 58828 | batch-file, python, python-idle | <h1>Running Python file by double-click</h1>
<p>I have really annoying problem, I cannot run a Python file just by double-clicking.</p>
<p>I have tried to set it to open the file with <code>idle.bat</code> but that only starts IDLE editor on double-click, it does not run the Python file.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,535 | cmd | # Running Python file by double-click
I have really annoying problem, I cannot run a Python file just by double-clicking.
I have tried to set it to open the file with `idle.bat` but that only starts IDLE editor on double-click, it does not run the Python file. | What version of Python do you have installed?
You should write your own batch file to execute your python binary and your script.
For example, with a default Python 2.7 installation on Windows, this could be the entire contents of your script.
`myscript.bat`:
```
ECHO ON
REM A batch script to execute a Python scrip... |
55087700 | Docker image different size when pushed to ECR than locally | 21 | 2019-03-10 12:31:13 | <p>I have a docker image that is 1.46GB on my local machine, but when this is pushed to AWS ECR (either via my local machine or via CicleCI deployment) it is only 537.05MB. I'm pretty new to Docker and to AWS, so any help in figuring out as to why this may be would be appreciated!</p>
<p>I have a feeling that it has n... | 10,964 | 5,588,987 | 2019-03-10 13:39:17 | 55,087,885 | 33 | 2019-03-10 12:55:03 | 2,336,650 | 2019-03-10 13:26:01 | https://stackoverflow.com/q/55087700 | https://stackoverflow.com/a/55087885 | <p>That could be due to how docker client acts before it pushes the image to ECR as <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-info.html" rel="noreferrer">documented</a>:</p>
<blockquote>
<p>Beginning with Docker version 1.9, the Docker client compresses image layers before pushing th... | <p>That could be due to how docker client acts before it pushes the image to ECR as <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-info.html" rel="noreferrer">documented</a>:</p> <blockquote> <p>Beginning with Docker version 1.9, the Docker client compresses image layers before pushing th... | 33388, 90304, 123441, 124227 | amazon-ecr, amazon-web-services, aws-batch, docker | <h1>Docker image different size when pushed to ECR than locally</h1>
<p>I have a docker image that is 1.46GB on my local machine, but when this is pushed to AWS ECR (either via my local machine or via CicleCI deployment) it is only 537.05MB. I'm pretty new to Docker and to AWS, so any help in figuring out as to why thi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,537 | cmd | # Docker image different size when pushed to ECR than locally
I have a docker image that is 1.46GB on my local machine, but when this is pushed to AWS ECR (either via my local machine or via CicleCI deployment) it is only 537.05MB. I'm pretty new to Docker and to AWS, so any help in figuring out as to why this may be ... | That could be due to how docker client acts before it pushes the image to ECR as [documented](https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-info.html):
> Beginning with Docker version 1.9, the Docker client compresses image layers before pushing them to a V2 Docker registry. The output of the docke... |
20397800 | git commit and push via batch file on Windows | 20 | 2013-12-05 10:42:16 | <p>I do same task often of committing and pushing changes to remote branch. Being lazy sometimes, I needed to put set of git commands to automatically perform these steps:</p>
<pre><code>cd D:\wamp\www\projectName
git checkout dev
git add .
git commit -am "made changes"
git push
pause
</code></pre>
<p>I also tried:</... | 39,813 | 1,806,275 | 2019-03-14 17:17:59 | 20,400,471 | 33 | 2013-12-05 12:47:31 | 641,955 | 2013-12-05 12:47:31 | https://stackoverflow.com/q/20397800 | https://stackoverflow.com/a/20400471 | <p>For me, by default, Windows executes <code>.sh</code> files correctly using Git Bash. So I would write your script as a regular bash shell script:</p>
<pre><code>#!/bin/sh
cd /d/wamp/www/projectName
git checkout dev
git add .
git commit -am "made changes"
git push
echo Press Enter...
read
</code></pre>
| <p>For me, by default, Windows executes <code>.sh</code> files correctly using Git Bash. So I would write your script as a regular bash shell script:</p> <pre><code>#!/bin/sh cd /d/wamp/www/projectName git checkout dev git add . git commit -am "made changes" git push echo Press Enter... read </code></pre> | 64, 119, 7002 | batch-file, git, windows | <h1>git commit and push via batch file on Windows</h1>
<p>I do same task often of committing and pushing changes to remote branch. Being lazy sometimes, I needed to put set of git commands to automatically perform these steps:</p>
<pre><code>cd D:\wamp\www\projectName
git checkout dev
git add .
git commit -am "made ch... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,538 | cmd | # git commit and push via batch file on Windows
I do same task often of committing and pushing changes to remote branch. Being lazy sometimes, I needed to put set of git commands to automatically perform these steps:
```
cd D:\wamp\www\projectName
git checkout dev
git add .
git commit -am "made changes"
git push
paus... | For me, by default, Windows executes `.sh` files correctly using Git Bash. So I would write your script as a regular bash shell script:
```
#!/bin/sh
cd /d/wamp/www/projectName
git checkout dev
git add .
git commit -am "made changes"
git push
echo Press Enter...
read
``` |
74267 | How to get an Batch file .bat continue onto the next statement if there is an error | 20 | 2008-09-16 16:32:17 | <p>I'm trying to script the shutdown of my VM Servers in a .bat.
if one of the vmware-cmd commands fails (as the machine is already shutdown say), I'd like it to continue instead of bombing out.</p>
<pre><code>c:
cd "c:\Program Files\VMWare\VmWare Server"
vmware-cmd C:\VMImages\TCVMDEVSQL01\TCVMDEVSQL01.vmx suspend s... | 52,332 | 11,538 | 2018-03-15 12:25:01 | 74,321 | 33 | 2008-09-16 16:37:59 | 3,055 | 2008-09-16 16:37:59 | https://stackoverflow.com/q/74267 | https://stackoverflow.com/a/74321 | <p>Run it inside another command instance with <code>CMD /C</code></p>
<pre><code>CMD /C vmware-cmd C:\...
</code></pre>
<p>This should keep the original BAT files running.</p>
| <p>Run it inside another command instance with <code>CMD /C</code></p> <pre><code>CMD /C vmware-cmd C:\... </code></pre> <p>This should keep the original BAT files running.</p> | 7002 | batch-file | <h1>How to get an Batch file .bat continue onto the next statement if there is an error</h1>
<p>I'm trying to script the shutdown of my VM Servers in a .bat.
if one of the vmware-cmd commands fails (as the machine is already shutdown say), I'd like it to continue instead of bombing out.</p>
<pre><code>c:
cd "c:\Progra... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,539 | cmd | # How to get an Batch file .bat continue onto the next statement if there is an error
I'm trying to script the shutdown of my VM Servers in a .bat.
if one of the vmware-cmd commands fails (as the machine is already shutdown say), I'd like it to continue instead of bombing out.
```
c:
cd "c:\Program Files\VMWare\VmWar... | Run it inside another command instance with `CMD /C`
```
CMD /C vmware-cmd C:\...
```
This should keep the original BAT files running. |
6478606 | Batch file IF statement fails with "was unexpected at this time" | 19 | 2011-06-25 15:09:54 | <p>I have a batch file that does the following:</p>
<pre><code>@IF EXIST "C:\Program Files\MyAppFolder" (
icacls "C:\Program Files\MyAppFolder" /inheritance:r
icacls "C:\Program Files\MyAppFolder" /GRANT SYSTEM:(CI)(OI)(F)
icacls "C:\Program Files\MyAppFolder" /GRANT Administrators:(CI)(OI)(F)
)
</code></pre>
<... | 37,454 | 419 | 2020-10-26 20:41:15 | 6,478,753 | 33 | 2011-06-25 15:38:41 | 56,338 | 2017-05-19 13:35:15 | https://stackoverflow.com/q/6478606 | https://stackoverflow.com/a/6478753 | <p>The shell seems to think that the <code>)</code> in the third line of your command is the closing parenthesis for the one opened in the first line. You need to quote the arguments containing parenthesis:</p>
<pre><code>@IF EXIST "C:\Program Files\MyAppFolder" (
icacls "C:\Program Files\MyAppFolder" /inheritance:r... | <p>The shell seems to think that the <code>)</code> in the third line of your command is the closing parenthesis for the one opened in the first line. You need to quote the arguments containing parenthesis:</p> <pre><code>@IF EXIST "C:\Program Files\MyAppFolder" ( icacls "C:\Program Files\MyAppFolder" /inheritance:r... | 7002 | batch-file | <h1>Batch file IF statement fails with "was unexpected at this time"</h1>
<p>I have a batch file that does the following:</p>
<pre><code>@IF EXIST "C:\Program Files\MyAppFolder" (
icacls "C:\Program Files\MyAppFolder" /inheritance:r
icacls "C:\Program Files\MyAppFolder" /GRANT SYSTEM:(CI)(OI)(F)
icacls "C:\Progr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,540 | cmd | # Batch file IF statement fails with "was unexpected at this time"
I have a batch file that does the following:
```
@IF EXIST "C:\Program Files\MyAppFolder" (
icacls "C:\Program Files\MyAppFolder" /inheritance:r
icacls "C:\Program Files\MyAppFolder" /GRANT SYSTEM:(CI)(OI)(F)
icacls "C:\Program Files\MyAppFolder... | The shell seems to think that the `)` in the third line of your command is the closing parenthesis for the one opened in the first line. You need to quote the arguments containing parenthesis:
```
@IF EXIST "C:\Program Files\MyAppFolder" (
icacls "C:\Program Files\MyAppFolder" /inheritance:r
icacls "C:\Program Fil... |
20138097 | Linux: command to make folders recursively writable without affecting the permission of files inside them | 17 | 2013-11-22 06:03:41 | <p>Is it possible to make the folders writable recursively without affecting the files inside them using Linux command.</p>
<p><code>chmod 777 -R foldername</code> - will make all folders and files inside the folder writable.</p>
<p>We've a website where we do not want the core files of a php framework writable, but ... | 34,800 | 1,878,050 | 2013-11-22 06:06:32 | 20,138,129 | 33 | 2013-11-22 06:06:09 | 2,235,132 | 2013-11-22 06:06:09 | https://stackoverflow.com/q/20138097 | https://stackoverflow.com/a/20138129 | <p>You can say:</p>
<pre><code>find foldername -type d -exec chmod 777 {} \;
</code></pre>
<p>This would only change the file mode for the <em>directories</em> and not the <em>files</em> within those.</p>
| <p>You can say:</p> <pre><code>find foldername -type d -exec chmod 777 {} \; </code></pre> <p>This would only change the file mode for the <em>directories</em> and not the <em>files</em> within those.</p> | 58, 1231, 2631, 12380 | chmod, cmd, command-line, linux | <h1>Linux: command to make folders recursively writable without affecting the permission of files inside them</h1>
<p>Is it possible to make the folders writable recursively without affecting the files inside them using Linux command.</p>
<p><code>chmod 777 -R foldername</code> - will make all folders and files inside... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,541 | cmd | # Linux: command to make folders recursively writable without affecting the permission of files inside them
Is it possible to make the folders writable recursively without affecting the files inside them using Linux command.
`chmod 777 -R foldername` - will make all folders and files inside the folder writable.
We'v... | You can say:
```
find foldername -type d -exec chmod 777 {} \;
```
This would only change the file mode for the *directories* and not the *files* within those. |
16552056 | Windows CMD Search and Delete file by name | 13 | 2013-05-14 20:15:47 | <p>I have a website dump which has about half a gig worth of images which have been converted to various file sizes. The structure goes like:</p>
<pre><code>media/
1/
1.original.jpg
1.large.jpg
1.medium.jpg
1.small.jpg
2/
2.original.jpg
2.large.jpg
2.medium.jpg
2.s... | 37,296 | 104,452 | 2018-03-12 04:42:23 | 16,554,982 | 33 | 2013-05-15 00:40:37 | 2,128,947 | 2018-03-12 04:42:23 | https://stackoverflow.com/q/16552056 | https://stackoverflow.com/a/16554982 | <pre><code>del /s ...\media\*original*.jpg
</code></pre>
<p>should delete all files with <code>original</code> in their name, extension <code>.jpg</code> from <code>...\media</code> and all its subdirectories.</p>
<p>Obviously, use with extreme caution...
If you desire to see what you are going to delete first before... | <pre><code>del /s ...\media\*original*.jpg </code></pre> <p>should delete all files with <code>original</code> in their name, extension <code>.jpg</code> from <code>...\media</code> and all its subdirectories.</p> <p>Obviously, use with extreme caution... If you desire to see what you are going to delete first before... | 64, 2631, 5310, 37510 | cmd, delete-file, file, windows | <h1>Windows CMD Search and Delete file by name</h1>
<p>I have a website dump which has about half a gig worth of images which have been converted to various file sizes. The structure goes like:</p>
<pre><code>media/
1/
1.original.jpg
1.large.jpg
1.medium.jpg
1.small.jpg
2/
2.origina... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,542 | cmd | # Windows CMD Search and Delete file by name
I have a website dump which has about half a gig worth of images which have been converted to various file sizes. The structure goes like:
```
media/
1/
1.original.jpg
1.large.jpg
1.medium.jpg
1.small.jpg
2/
2.original.jpg
2.large.... | ```
del /s ...\media\*original*.jpg
```
should delete all files with `original` in their name, extension `.jpg` from `...\media` and all its subdirectories.
Obviously, use with extreme caution...
If you desire to see what you are going to delete first before deleting it use
```
dir /s ...\media\*original*.jpg
``` |
1537065 | How can I create a shared folder from the Windows command line? | 26 | 2009-10-08 10:55:57 | <p>As far as I'm aware, this is done via the <code>net</code> command.</p>
<p>However, the help section isn't very helpful, as it only shows me the secondary options and not how to use those.</p>
<p>Suppose I had a folder <code>C:\Share_test</code></p>
<p>How would I make it shared from the command line?</p>
| 109,896 | 80,907 | 2014-03-05 22:26:25 | 1,537,081 | 32 | 2009-10-08 10:59:36 | 100,754 | 2014-03-05 22:26:25 | https://stackoverflow.com/q/1537065 | https://stackoverflow.com/a/1537081 | <p><code>C:\></code> <a href="http://technet.microsoft.com/en-us/library/bb490712.aspx" rel="noreferrer"><code>net help share</code></a></p>
<p>For example:</p>
<blockquote>
<p>To share a computer's <code>C:\Data</code> directory with the share name <code>DataShare</code> and include a remark, type:</p>
<p><code>net... | <p><code>C:\></code> <a href="http://technet.microsoft.com/en-us/library/bb490712.aspx" rel="noreferrer"><code>net help share</code></a></p> <p>For example:</p> <blockquote> <p>To share a computer's <code>C:\Data</code> directory with the share name <code>DataShare</code> and include a remark, type:</p> <p><code>net... | 64, 2631, 8032 | cmd, shared-directory, windows | <h1>How can I create a shared folder from the Windows command line?</h1>
<p>As far as I'm aware, this is done via the <code>net</code> command.</p>
<p>However, the help section isn't very helpful, as it only shows me the secondary options and not how to use those.</p>
<p>Suppose I had a folder <code>C:\Share_test</co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,544 | cmd | # How can I create a shared folder from the Windows command line?
As far as I'm aware, this is done via the `net` command.
However, the help section isn't very helpful, as it only shows me the secondary options and not how to use those.
Suppose I had a folder `C:\Share_test`
How would I make it shared from the comm... | `C:\>` [`net help share`](http://technet.microsoft.com/en-us/library/bb490712.aspx)
For example:
> To share a computer's `C:\Data` directory with the share name `DataShare` and include a remark, type:
>
> `net share DataShare=c:\Data /remark:"For department 123."` |
19843849 | Unexpected "The system cannot find the drive specified." in batch file | 24 | 2013-11-07 18:31:10 | <p>I've got a problem with a batch file (Windows 7 x64). I've managed to reduce it to the following (there are two empty comment lines; it doesn't seem to matter whether there's an actual comment):</p>
<pre><code>@echo off
if /i [%1]==[] (
echo A
::
::
echo B
)
</code></pre>
<p>Putting this in a batc... | 30,662 | 241,605 | 2024-05-22 11:17:21 | 19,847,135 | 32 | 2013-11-07 21:34:22 | 463,115 | 2024-05-22 11:17:21 | https://stackoverflow.com/q/19843849 | https://stackoverflow.com/a/19847135 | <p>It's an obscure effect in batch code blocks.</p>
<p>In a code block, a label in one line always requires a secondary line with quite different syntax rules (for a <em>secondary</em> line).<br />
<a href="https://stackoverflow.com/a/4006006/463115">SO: goto command not working</a></p>
<p>The secondary line must be a ... | <p>It's an obscure effect in batch code blocks.</p> <p>In a code block, a label in one line always requires a secondary line with quite different syntax rules (for a <em>secondary</em> line).<br /> <a href="https://stackoverflow.com/a/4006006/463115">SO: goto command not working</a></p> <p>The secondary line must be a ... | 64, 7002 | batch-file, windows | <h1>Unexpected "The system cannot find the drive specified." in batch file</h1>
<p>I've got a problem with a batch file (Windows 7 x64). I've managed to reduce it to the following (there are two empty comment lines; it doesn't seem to matter whether there's an actual comment):</p>
<pre><code>@echo off
if /i [%1]==[] ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,545 | cmd | # Unexpected "The system cannot find the drive specified." in batch file
I've got a problem with a batch file (Windows 7 x64). I've managed to reduce it to the following (there are two empty comment lines; it doesn't seem to matter whether there's an actual comment):
```
@echo off
if /i [%1]==[] (
echo A
::
... | It's an obscure effect in batch code blocks.
In a code block, a label in one line always requires a secondary line with quite different syntax rules (for a *secondary* line).
[SO: goto command not working](https://stackoverflow.com/a/4006006/463115)
The secondary line must be a command or simple label, but not a pa... |
31622469 | Why does 'Run as administrator' change (sometimes) batch file's current directory? | 19 | 2015-07-25 03:04:27 | <p>I have a batch file that is in the same directory as the file I want to <code>xcopy</code>. But for some reason the file is not being found.</p>
<p>I thought that current directory was always where the batch file was located.</p>
<p>I run batch file as administrator. This occurs on a Windows 7 64-bit desktop compu... | 26,492 | 1,155,237 | 2018-08-18 12:25:39 | 31,655,249 | 32 | 2015-07-27 14:02:06 | 3,074,564 | 2017-09-20 08:48:42 | https://stackoverflow.com/q/31622469 | https://stackoverflow.com/a/31655249 | <p>Which directory is current working directory on starting a batch file with context menu item <strong>Run as administrator</strong> depends on <strong>User Account Control</strong> (UAC) setting for the current user.</p>
<p>This can be demonstrated with following small batch file <code>C:\Temp\Test.bat</code>:</p>
... | <p>Which directory is current working directory on starting a batch file with context menu item <strong>Run as administrator</strong> depends on <strong>User Account Control</strong> (UAC) setting for the current user.</p> <p>This can be demonstrated with following small batch file <code>C:\Temp\Test.bat</code>:</p> ... | 5910, 7002, 10201, 34595 | batch-file, process, windows-7, working-directory | <h1>Why does 'Run as administrator' change (sometimes) batch file's current directory?</h1>
<p>I have a batch file that is in the same directory as the file I want to <code>xcopy</code>. But for some reason the file is not being found.</p>
<p>I thought that current directory was always where the batch file was located... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,547 | cmd | # Why does 'Run as administrator' change (sometimes) batch file's current directory?
I have a batch file that is in the same directory as the file I want to `xcopy`. But for some reason the file is not being found.
I thought that current directory was always where the batch file was located.
I run batch file as admi... | Which directory is current working directory on starting a batch file with context menu item **Run as administrator** depends on **User Account Control** (UAC) setting for the current user.
This can be demonstrated with following small batch file `C:\Temp\Test.bat`:
```
@echo Current directory is: %CD%
@pause
```
--... |
36857098 | Extract first character from a string | 18 | 2016-04-26 06:40:09 | <p>I've no knowledge regarding Windows batch programming syntax. I have a text file containing user IDs which I need to delete using curl command and for that I need to extract first character of every user ID and then pass to the curl command. I know the curl command which will require two variables:</p>
<ol>
<li>'Use... | 46,706 | 3,309,812 | 2022-12-05 12:24:06 | 36,874,146 | 32 | 2016-04-26 19:32:32 | 447,901 | 2016-04-26 19:32:32 | https://stackoverflow.com/q/36857098 | https://stackoverflow.com/a/36874146 | <p>The <code>cmd.exe</code> can do a limited amount of string parsing. JosefZ gave you a good place to start.</p>
<pre><code>C:>echo %PROCESSOR_ARCHITECTURE%
AMD64
C:>echo %PROCESSOR_ARCHITECTURE:~0,1%
A
</code></pre>
| <p>The <code>cmd.exe</code> can do a limited amount of string parsing. JosefZ gave you a good place to start.</p> <pre><code>C:>echo %PROCESSOR_ARCHITECTURE% AMD64 C:>echo %PROCESSOR_ARCHITECTURE:~0,1% A </code></pre> | 64, 1231, 2631, 7002 | batch-file, cmd, command-line, windows | <h1>Extract first character from a string</h1>
<p>I've no knowledge regarding Windows batch programming syntax. I have a text file containing user IDs which I need to delete using curl command and for that I need to extract first character of every user ID and then pass to the curl command. I know the curl command whic... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,548 | cmd | # Extract first character from a string
I've no knowledge regarding Windows batch programming syntax. I have a text file containing user IDs which I need to delete using curl command and for that I need to extract first character of every user ID and then pass to the curl command. I know the curl command which will re... | The `cmd.exe` can do a limited amount of string parsing. JosefZ gave you a good place to start.
```
C:>echo %PROCESSOR_ARCHITECTURE%
AMD64
C:>echo %PROCESSOR_ARCHITECTURE:~0,1%
A
``` |
1025410 | Find and rename files with no extension? | 18 | 2009-06-22 03:54:06 | <p>So, I've got a bunch of files with no extension. I want to write a windows batch script that will:</p>
<ol>
<li>Find files with no extension (in a specified folder)</li>
<li>Add .bla to the end of the file name</li>
</ol>
<p>I'm such a windows batch script noob I don't even know where to start. Suggestions?</p>
| 27,264 | 80,544 | 2019-03-30 20:13:53 | 1,025,414 | 32 | 2009-06-22 03:58:41 | 76,673 | 2009-06-22 04:55:29 | https://stackoverflow.com/q/1025410 | https://stackoverflow.com/a/1025414 | <p>For windows batch files, this will rename only files with no extension to the .bla extension:</p>
<pre><code>rename *. *.bla
</code></pre>
<p>Notice the first argument is a star and a dot: *.</p>
<p>The second argument is: *.bla</p>
<p>The start dot (*.) combination represents files with no extensions in this co... | <p>For windows batch files, this will rename only files with no extension to the .bla extension:</p> <pre><code>rename *. *.bla </code></pre> <p>Notice the first argument is a star and a dot: *.</p> <p>The second argument is: *.bla</p> <p>The start dot (*.) combination represents files with no extensions in this co... | 64, 531, 4510, 7002 | batch-file, rename, scripting, windows | <h1>Find and rename files with no extension?</h1>
<p>So, I've got a bunch of files with no extension. I want to write a windows batch script that will:</p>
<ol>
<li>Find files with no extension (in a specified folder)</li>
<li>Add .bla to the end of the file name</li>
</ol>
<p>I'm such a windows batch script noob I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,549 | cmd | # Find and rename files with no extension?
So, I've got a bunch of files with no extension. I want to write a windows batch script that will:
1. Find files with no extension (in a specified folder)
2. Add .bla to the end of the file name
I'm such a windows batch script noob I don't even know where to start. Suggesti... | For windows batch files, this will rename only files with no extension to the .bla extension:
```
rename *. *.bla
```
Notice the first argument is a star and a dot: *.
The second argument is: *.bla
The start dot (*.) combination represents files with no extensions in this context.
Before:
```
06/21/2009 11:57 PM... |
34936240 | Batch goto loses errorlevel | 13 | 2016-01-21 23:17:23 | <p>Consider the following bat, test.bat (PC01 is off):</p>
<pre><code>mkdir \\PC01\\c$\Test || goto :eof
</code></pre>
<p>If I run that bat from a command shell:</p>
<pre><code>> test.bat || echo 99
> if ERRORLEVEL 1 echo 55
</code></pre>
<p>The output is just 55. No 99. There is an errorlevel, but the <code>... | 9,824 | 4,919,054 | 2018-08-22 14:10:50 | 34,937,706 | 32 | 2016-01-22 01:53:03 | 1,012,053 | 2018-08-22 14:10:50 | https://stackoverflow.com/q/34936240 | https://stackoverflow.com/a/34937706 | <p>In most circumstances, <a href="https://stackoverflow.com/a/10936093/1012053"><code>||</code> is the most reliable way to detect an error</a>. But you have stumbled on one of the rare cases where ERRORLEVEL works but <code>||</code> does not.</p>
<p>The problem stems from the fact that your error is raised within a... | <p>In most circumstances, <a href="https://stackoverflow.com/a/10936093/1012053"><code>||</code> is the most reliable way to detect an error</a>. But you have stumbled on one of the rare cases where ERRORLEVEL works but <code>||</code> does not.</p> <p>The problem stems from the fact that your error is raised within a... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>Batch goto loses errorlevel</h1>
<p>Consider the following bat, test.bat (PC01 is off):</p>
<pre><code>mkdir \\PC01\\c$\Test || goto :eof
</code></pre>
<p>If I run that bat from a command shell:</p>
<pre><code>> test.bat || echo 99
> if ERRORLEVEL 1 echo 55
</code></pre>
<p>The output is just 55. No 99. T... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,551 | cmd | # Batch goto loses errorlevel
Consider the following bat, test.bat (PC01 is off):
```
mkdir \\PC01\\c$\Test || goto :eof
```
If I run that bat from a command shell:
```
> test.bat || echo 99
> if ERRORLEVEL 1 echo 55
```
The output is just 55. No 99. There is an errorlevel, but the `||` operator did not see it.
I... | In most circumstances, [`||` is the most reliable way to detect an error](https://stackoverflow.com/a/10936093/1012053). But you have stumbled on one of the rare cases where ERRORLEVEL works but `||` does not.
The problem stems from the fact that your error is raised within a batch script, and `||` responds to the ret... |
16087694 | auto run a bat script in windows 7 at login | 13 | 2013-04-18 15:56:37 | <p>I have recently acquired a windows 7 laptop from my late grandmother.
I have been using it for work and other things. I decided to create a VM using VirtualBox And now I want to create a user on the (Windows 7 Host) machine so that when I log into that user it autoruns a .bat script to start the VM. To make it clear... | 111,001 | 2,125,339 | 2015-03-07 05:05:48 | 16,089,171 | 32 | 2013-04-18 17:09:12 | 2,073,862 | 2013-04-18 17:14:49 | https://stackoverflow.com/q/16087694 | https://stackoverflow.com/a/16089171 | <p>To run the batch file when the <code>VM</code> user logs in:</p>
<p>Drag the shortcut--the one that's currently on your desktop--(or the batch file itself) to Start - All Programs - Startup. Now when you login as that user, it will launch the batch file.</p>
<p>Another way to do the same thing is to save the shor... | <p>To run the batch file when the <code>VM</code> user logs in:</p> <p>Drag the shortcut--the one that's currently on your desktop--(or the batch file itself) to Start - All Programs - Startup. Now when you login as that user, it will launch the batch file.</p> <p>Another way to do the same thing is to save the shor... | 3304, 7002, 9952, 34595 | autorun, batch-file, virtual-machine, windows-7 | <h1>auto run a bat script in windows 7 at login</h1>
<p>I have recently acquired a windows 7 laptop from my late grandmother.
I have been using it for work and other things. I decided to create a VM using VirtualBox And now I want to create a user on the (Windows 7 Host) machine so that when I log into that user it aut... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,552 | cmd | # auto run a bat script in windows 7 at login
I have recently acquired a windows 7 laptop from my late grandmother.
I have been using it for work and other things. I decided to create a VM using VirtualBox And now I want to create a user on the (Windows 7 Host) machine so that when I log into that user it autoruns a .... | To run the batch file when the `VM` user logs in:
Drag the shortcut--the one that's currently on your desktop--(or the batch file itself) to Start - All Programs - Startup. Now when you login as that user, it will launch the batch file.
Another way to do the same thing is to save the shortcut or the batch file in `%A... |
47197885 | How to do fully connected batch norm in PyTorch? | 12 | 2017-11-09 09:13:50 | <p><code>torch.nn</code> has classes <code>BatchNorm1d</code>, <code>BatchNorm2d</code>, <code>BatchNorm3d</code>, but it doesn't have a fully connected BatchNorm class? What is the standard way of doing normal Batch Norm in PyTorch? </p>
| 26,922 | 3,990,607 | 2020-02-02 20:36:49 | 47,202,205 | 32 | 2017-11-09 12:44:44 | 3,990,607 | 2020-02-02 20:36:49 | https://stackoverflow.com/q/47197885 | https://stackoverflow.com/a/47202205 | <p>Ok. I figured it out. <code>BatchNorm1d</code> can also handle Rank-2 tensors, thus it is possible to use <code>BatchNorm1d</code> for the normal fully-connected case.</p>
<p>So for example:</p>
<pre><code>import torch.nn as nn
class Policy(nn.Module):
def __init__(self, num_inputs, action_space, hidden_size1=25... | <p>Ok. I figured it out. <code>BatchNorm1d</code> can also handle Rank-2 tensors, thus it is possible to use <code>BatchNorm1d</code> for the normal fully-connected case.</p> <p>So for example:</p> <pre><code>import torch.nn as nn class Policy(nn.Module): def __init__(self, num_inputs, action_space, hidden_size1=25... | 16, 40102, 100570, 124253, 124994 | batch-normalization, deep-learning, neural-network, python, pytorch | <h1>How to do fully connected batch norm in PyTorch?</h1>
<p><code>torch.nn</code> has classes <code>BatchNorm1d</code>, <code>BatchNorm2d</code>, <code>BatchNorm3d</code>, but it doesn't have a fully connected BatchNorm class? What is the standard way of doing normal Batch Norm in PyTorch? </p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,553 | cmd | # How to do fully connected batch norm in PyTorch?
`torch.nn` has classes `BatchNorm1d`, `BatchNorm2d`, `BatchNorm3d`, but it doesn't have a fully connected BatchNorm class? What is the standard way of doing normal Batch Norm in PyTorch? | Ok. I figured it out. `BatchNorm1d` can also handle Rank-2 tensors, thus it is possible to use `BatchNorm1d` for the normal fully-connected case.
So for example:
```
import torch.nn as nn
class Policy(nn.Module):
def __init__(self, num_inputs, action_space, hidden_size1=256, hidden_size2=128):
super(Policy, sel... |
9904608 | How do I write a batch script that copies one directory to another, replaces old files? | 11 | 2012-03-28 09:25:26 | <p>I'd like a batch script in Windows with which I can copy one directory to another. If this directory already exists, and then for each file that already exists in both with the same name and location, it should be overwritten, if it does not exists, it should just be added.</p>
<p>In the end it should be a batch sc... | 145,734 | 1,004,708 | 2015-06-25 06:06:12 | 9,904,768 | 32 | 2012-03-28 09:35:05 | 961,113 | 2015-03-10 14:31:38 | https://stackoverflow.com/q/9904608 | https://stackoverflow.com/a/9904768 | <p>In your batch file do this</p>
<pre><code>set source=C:\Users\Habib\test
set destination=C:\Users\Habib\testdest\
xcopy %source% %destination% /y
</code></pre>
<p>If you want to copy the sub directories <strong>including empty directories</strong> then do:</p>
<pre><code>xcopy %source% %destination% /E /y
</code>... | <p>In your batch file do this</p> <pre><code>set source=C:\Users\Habib\test set destination=C:\Users\Habib\testdest\ xcopy %source% %destination% /y </code></pre> <p>If you want to copy the sub directories <strong>including empty directories</strong> then do:</p> <pre><code>xcopy %source% %destination% /E /y </code>... | 64, 7002 | batch-file, windows | <h1>How do I write a batch script that copies one directory to another, replaces old files?</h1>
<p>I'd like a batch script in Windows with which I can copy one directory to another. If this directory already exists, and then for each file that already exists in both with the same name and location, it should be overwr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,554 | cmd | # How do I write a batch script that copies one directory to another, replaces old files?
I'd like a batch script in Windows with which I can copy one directory to another. If this directory already exists, and then for each file that already exists in both with the same name and location, it should be overwritten, if... | In your batch file do this
```
set source=C:\Users\Habib\test
set destination=C:\Users\Habib\testdest\
xcopy %source% %destination% /y
```
If you want to copy the sub directories **including empty directories** then do:
```
xcopy %source% %destination% /E /y
```
If you only want to copy sub directories and not empt... |
60389507 | CMD batch - encode file to base 64 and trim characters and new line | 10 | 2020-02-25 07:31:28 | <h2>I'm trying to make a batch file from CMD with the following commands:</h2>
<ol>
<li>Convert file to base 64 - using certutil command this is how the contents of the base 64 looks like (B64.txt): </li>
</ol>
<p><a href="https://i.sstatic.net/Do5Dn.png" rel="noreferrer"><img src="https://i.sstatic.net/Do5Dn.png" al... | 13,562 | 9,393,989 | 2022-05-05 03:51:12 | 60,404,255 | 32 | 2020-02-25 22:42:48 | 1,012,053 | 2020-02-25 22:42:48 | https://stackoverflow.com/q/60389507 | https://stackoverflow.com/a/60404255 | <p>There is a really simple solution using undocumented features of CERTUTIL. You can use the<br>
<code>-ENCODEHEX</code> verb with an undocumented format at the end to directly get your desired output of base 64 all on one line without any headers.</p>
<pre><code>certutil -encodehex -f sample.pdf B64.txt 0x40000001
<... | <p>There is a really simple solution using undocumented features of CERTUTIL. You can use the<br> <code>-ENCODEHEX</code> verb with an undocumented format at the end to directly get your desired output of base 64 all on one line without any headers.</p> <pre><code>certutil -encodehex -f sample.pdf B64.txt 0x40000001 <... | 1011, 2631, 3705, 5641, 7002 | base64, batch-file, cmd, newline, trim | <h1>CMD batch - encode file to base 64 and trim characters and new line</h1>
<h2>I'm trying to make a batch file from CMD with the following commands:</h2>
<ol>
<li>Convert file to base 64 - using certutil command this is how the contents of the base 64 looks like (B64.txt): </li>
</ol>
<p><a href="https://i.sstatic.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,555 | cmd | # CMD batch - encode file to base 64 and trim characters and new line
## I'm trying to make a batch file from CMD with the following commands:
1. Convert file to base 64 - using certutil command this is how the contents of the base 64 looks like (B64.txt):
[](http... | There is a really simple solution using undocumented features of CERTUTIL. You can use the
`-ENCODEHEX` verb with an undocumented format at the end to directly get your desired output of base 64 all on one line without any headers.
```
certutil -encodehex -f sample.pdf B64.txt 0x40000001
```
See the DosTips [More T... |
28318673 | Login to Perforce from Commandline | 10 | 2015-02-04 10:11:18 | <p>I would like to login to Perforce(P4) from the command line.
I tried using </p>
<pre><code>p4 -u My_Username login
</code></pre>
<p>But how do I provide the password. I need this to check-in a file from the command line.</p>
| 51,872 | 4,407,804 | 2019-09-26 21:01:16 | 28,326,518 | 32 | 2015-02-04 16:32:05 | 3,799,759 | 2015-02-04 18:36:52 | https://stackoverflow.com/q/28318673 | https://stackoverflow.com/a/28326518 | <p>Before connecting to the server, set P4PORT (to tell the client where the server is) and P4USER (to tell the server who you are). P4PORT is specified as hostname:port, with the port usually (but not always) being 1666. If you're not sure what your Perforce server address and user name are, check with your sys admi... | <p>Before connecting to the server, set P4PORT (to tell the client where the server is) and P4USER (to tell the server who you are). P4PORT is specified as hostname:port, with the port usually (but not always) being 1666. If you're not sure what your Perforce server address and user name are, check with your sys admi... | 1231, 1286, 2631 | cmd, command-line, perforce | <h1>Login to Perforce from Commandline</h1>
<p>I would like to login to Perforce(P4) from the command line.
I tried using </p>
<pre><code>p4 -u My_Username login
</code></pre>
<p>But how do I provide the password. I need this to check-in a file 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 | 12,556 | cmd | # Login to Perforce from Commandline
I would like to login to Perforce(P4) from the command line.
I tried using
```
p4 -u My_Username login
```
But how do I provide the password. I need this to check-in a file from the command line. | Before connecting to the server, set P4PORT (to tell the client where the server is) and P4USER (to tell the server who you are). P4PORT is specified as hostname:port, with the port usually (but not always) being 1666. If you're not sure what your Perforce server address and user name are, check with your sys admin.
`... |
5642021 | Batch process all files in directory | 10 | 2011-04-12 21:48:01 | <p>Right now i have a batch job I wrote that calls another file and passes in the variables that executable needs to run (password and filename). </p>
<p>Ex:</p>
<pre><code>> cd f:\test\utils
> admin import-xml -Dimport.file=f:\DB\file1.xml -Dadmin.db.password=test123
</code></pre>
<p>I wrote a job that does... | 52,502 | 697,671 | 2013-03-14 06:42:57 | 5,644,619 | 32 | 2011-04-13 04:57:55 | 73,070 | 2013-03-14 06:42:57 | https://stackoverflow.com/q/5642021 | https://stackoverflow.com/a/5644619 | <pre><code>pushd C:\test\utils
for %%F in (F:\DB\*.xml) do (
admin import-xml "-Dimport.file=%%~dpnxF" -Dadmin.db.password=test123
)
popd
</code></pre>
<p>The <code>%%~dpnxF</code> expands to <strong>d</strong>rive, <strong>p</strong>ath, base<strong>n</strong>ame and e<strong>x</strong>tension of the current... | <pre><code>pushd C:\test\utils for %%F in (F:\DB\*.xml) do ( admin import-xml "-Dimport.file=%%~dpnxF" -Dadmin.db.password=test123 ) popd </code></pre> <p>The <code>%%~dpnxF</code> expands to <strong>d</strong>rive, <strong>p</strong>ath, base<strong>n</strong>ame and e<strong>x</strong>tension of the current... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>Batch process all files in directory</h1>
<p>Right now i have a batch job I wrote that calls another file and passes in the variables that executable needs to run (password and filename). </p>
<p>Ex:</p>
<pre><code>> cd f:\test\utils
> admin import-xml -Dimport.file=f:\DB\file1.xml -Dadmin.db.password=tes... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,557 | cmd | # Batch process all files in directory
Right now i have a batch job I wrote that calls another file and passes in the variables that executable needs to run (password and filename).
Ex:
```
> cd f:\test\utils
> admin import-xml -Dimport.file=f:\DB\file1.xml -Dadmin.db.password=test123
```
I wrote a job that does ... | ```
pushd C:\test\utils
for %%F in (F:\DB\*.xml) do (
admin import-xml "-Dimport.file=%%~dpnxF" -Dadmin.db.password=test123
)
popd
```
The `%%~dpnxF` expands to **d**rive, **p**ath, base**n**ame and e**x**tension of the current file.
If you intend to set *and* use environment variables (`%foo%`) in that loop... |
17702040 | How to delete all files in a directory using batch? | 7 | 2013-07-17 14:08:07 | <p>I have a very simple query.
I have a folder "x" on my desktop (Windows 7),
and I want to write a Batch Program to delete all files in it. (all extensions)
This is what I've come up with:</p>
<pre><code>cd c:\users\admin\desktop\x\
del *.*
</code></pre>
<p>but, when I open it, the console still asks for Human inpu... | 86,770 | 2,591,717 | 2015-09-05 09:05:38 | 17,720,127 | 32 | 2013-07-18 09:53:06 | 2,299,431 | 2013-07-18 09:53:06 | https://stackoverflow.com/q/17702040 | https://stackoverflow.com/a/17720127 | <p>Always use the explicit path so a flaw does not delete the current folder, whatever that may be at the time.</p>
<p>All visible files, silently</p>
<pre><code>del "c:\users\admin\desktop\x\*.*?"
</code></pre>
<p>All visible files, silently using /q</p>
<pre><code>del /q "c:\users\admin\desktop\x\*.*"
</code></pr... | <p>Always use the explicit path so a flaw does not delete the current folder, whatever that may be at the time.</p> <p>All visible files, silently</p> <pre><code>del "c:\users\admin\desktop\x\*.*?" </code></pre> <p>All visible files, silently using /q</p> <pre><code>del /q "c:\users\admin\desktop\x\*.*" </code></pr... | 488, 7002, 37510 | batch-file, console, delete-file | <h1>How to delete all files in a directory using batch?</h1>
<p>I have a very simple query.
I have a folder "x" on my desktop (Windows 7),
and I want to write a Batch Program to delete all files in it. (all extensions)
This is what I've come up with:</p>
<pre><code>cd c:\users\admin\desktop\x\
del *.*
</code></pre>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,558 | cmd | # How to delete all files in a directory using batch?
I have a very simple query.
I have a folder "x" on my desktop (Windows 7),
and I want to write a Batch Program to delete all files in it. (all extensions)
This is what I've come up with:
```
cd c:\users\admin\desktop\x\
del *.*
```
but, when I open it, the consol... | Always use the explicit path so a flaw does not delete the current folder, whatever that may be at the time.
All visible files, silently
```
del "c:\users\admin\desktop\x\*.*?"
```
All visible files, silently using /q
```
del /q "c:\users\admin\desktop\x\*.*"
```
All visible files, including subdirectories, silent... |
3050898 | How to check if ping responded or not in a batch file | 57 | 2010-06-16 05:27:21 | <p>I want to continuously ping a server and see a message box when ever it responds i.e. server is currently down. I want to do it through batch file.</p>
<p>I can show a message box as said here <a href="https://stackoverflow.com/questions/774175/how-can-i-open-a-message-box-in-a-windows-batch-file/774253#774253">Sho... | 234,946 | 148,271 | 2024-11-27 00:34:45 | 3,050,945 | 31 | 2010-06-16 05:39:16 | 14,860 | 2017-03-30 20:28:46 | https://stackoverflow.com/q/3050898 | https://stackoverflow.com/a/3050945 | <p>The following <code>checklink.cmd</code> program is a good place to start. It relies on the fact that you can do a single-shot ping and that, if successful, the output will contain the line:</p>
<pre><code>Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
</code></pre>
<p>By extracting tokens 5 and 7 and checki... | <p>The following <code>checklink.cmd</code> program is a good place to start. It relies on the fact that you can do a single-shot ping and that, if successful, the output will contain the line:</p> <pre><code>Packets: Sent = 1, Received = 1, Lost = 0 (0% loss), </code></pre> <p>By extracting tokens 5 and 7 and checki... | 1231, 5649, 7002 | batch-file, command-line, ping | <h1>How to check if ping responded or not in a batch file</h1>
<p>I want to continuously ping a server and see a message box when ever it responds i.e. server is currently down. I want to do it through batch file.</p>
<p>I can show a message box as said here <a href="https://stackoverflow.com/questions/774175/how-can-... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,559 | cmd | # How to check if ping responded or not in a batch file
I want to continuously ping a server and see a message box when ever it responds i.e. server is currently down. I want to do it through batch file.
I can show a message box as said here [Show a popup/message box from a Windows batch file](https://stackoverflow.c... | The following `checklink.cmd` program is a good place to start. It relies on the fact that you can do a single-shot ping and that, if successful, the output will contain the line:
```
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
```
By extracting tokens 5 and 7 and checking they're respectively `"Received"` a... |
2524928 | dos batch iterate through a delimited string | 46 | 2010-03-26 16:32:16 | <p>I have a delimited list of IPs I'd like to process individually. The list length is unknown ahead of time. How do I split and process each item in the list?</p>
<pre><code>@echo off
set servers=127.0.0.1,192.168.0.1,10.100.0.1
FOR /f "tokens=* delims=," %%a IN ("%servers%") DO call :sub %%a
:sub
echo In sub... | 97,061 | 223,214 | 2023-03-19 06:54:00 | 2,525,008 | 31 | 2010-03-26 16:42:12 | 17,028 | 2010-03-26 17:48:36 | https://stackoverflow.com/q/2524928 | https://stackoverflow.com/a/2525008 | <p><strong>Update</strong>: If the number of items in the list is not known, it is still possible to parse all items with simple recursion on the head of the list. (I've changed the IPs to simple numbers for simplicity of the list)</p>
<p><em>Finally that Lisp class I took 18 years ago paid off...</em></p>
<pre><code... | <p><strong>Update</strong>: If the number of items in the list is not known, it is still possible to parse all items with simple recursion on the head of the list. (I've changed the IPs to simple numbers for simplicity of the list)</p> <p><em>Finally that Lisp class I took 18 years ago paid off...</em></p> <pre><code... | 1231, 7002 | batch-file, command-line | <h1>dos batch iterate through a delimited string</h1>
<p>I have a delimited list of IPs I'd like to process individually. The list length is unknown ahead of time. How do I split and process each item in the list?</p>
<pre><code>@echo off
set servers=127.0.0.1,192.168.0.1,10.100.0.1
FOR /f "tokens=* delims=," %%a I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,560 | cmd | # dos batch iterate through a delimited string
I have a delimited list of IPs I'd like to process individually. The list length is unknown ahead of time. How do I split and process each item in the list?
```
@echo off
set servers=127.0.0.1,192.168.0.1,10.100.0.1
FOR /f "tokens=* delims=," %%a IN ("%servers%") DO cal... | **Update**: If the number of items in the list is not known, it is still possible to parse all items with simple recursion on the head of the list. (I've changed the IPs to simple numbers for simplicity of the list)
*Finally that Lisp class I took 18 years ago paid off...*
```
@echo off
setlocal
set servers=1,2,3,4,... |
3294599 | Do Batch files support multiline variables | 38 | 2010-07-20 21:41:03 | <p>If so How? </p>
<p>Yes, batch files are lame, but I cannot use powershell, and I don't feel like writing a real app to do this simple task....</p>
<p><b>edit</b></p>
<p>What i want is somthing along the lines of</p>
<pre><code>set var="this is a
multi
line
string "
</code></pre>
| 56,180 | 42,304 | 2022-08-11 22:10:47 | 7,045,156 | 31 | 2011-08-12 19:10:08 | 463,115 | 2011-08-12 19:10:08 | https://stackoverflow.com/q/3294599 | https://stackoverflow.com/a/7045156 | <p>Or you can create a "real" newline character.</p>
<pre><code>setlocal enableDelayedExpansion
set NL=^
rem two empty line required
echo first line !NL! second line
set multi=Line1!NL!Line2
set multi=!multi!!NL!Line3
echo !Multi!
</code></pre>
<p>With this variant the newline is a "normal" character in the string,... | <p>Or you can create a "real" newline character.</p> <pre><code>setlocal enableDelayedExpansion set NL=^ rem two empty line required echo first line !NL! second line set multi=Line1!NL!Line2 set multi=!multi!!NL!Line3 echo !Multi! </code></pre> <p>With this variant the newline is a "normal" character in the string,... | 64, 7002 | batch-file, windows | <h1>Do Batch files support multiline variables</h1>
<p>If so How? </p>
<p>Yes, batch files are lame, but I cannot use powershell, and I don't feel like writing a real app to do this simple task....</p>
<p><b>edit</b></p>
<p>What i want is somthing along the lines of</p>
<pre><code>set var="this is a
multi
line
s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,561 | cmd | # Do Batch files support multiline variables
If so How?
Yes, batch files are lame, but I cannot use powershell, and I don't feel like writing a real app to do this simple task....
**edit**
What i want is somthing along the lines of
```
set var="this is a
multi
line
string "
``` | Or you can create a "real" newline character.
```
setlocal enableDelayedExpansion
set NL=^
rem two empty line required
echo first line !NL! second line
set multi=Line1!NL!Line2
set multi=!multi!!NL!Line3
echo !Multi!
```
With this variant the newline is a "normal" character in the string, so the variables act norma... |
7159941 | How to Change to current user's directory in a batch file | 30 | 2011-08-23 10:56:37 | <p>How is it possible to change to a user default directory</p>
<p>Is there a default variable that can be used e.g. %USER%</p>
<p>would return: C:\Users\MyUsername</p>
| 31,231 | 907,471 | 2016-03-08 18:22:01 | 7,159,976 | 31 | 2011-08-23 10:59:14 | 1,583 | 2011-08-23 10:59:14 | https://stackoverflow.com/q/7159941 | https://stackoverflow.com/a/7159976 | <p>Use <a href="http://environmentvariables.org/index.php?title=HomePath"><code>%HOMEPATH%</code></a>.</p>
<p>So:</p>
<pre><code>CD %HOMEPATH%
</code></pre>
| <p>Use <a href="http://environmentvariables.org/index.php?title=HomePath"><code>%HOMEPATH%</code></a>.</p> <p>So:</p> <pre><code>CD %HOMEPATH% </code></pre> | 64, 2631, 7002 | batch-file, cmd, windows | <h1>How to Change to current user's directory in a batch file</h1>
<p>How is it possible to change to a user default directory</p>
<p>Is there a default variable that can be used e.g. %USER%</p>
<p>would return: C:\Users\MyUsername</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,562 | cmd | # How to Change to current user's directory in a batch file
How is it possible to change to a user default directory
Is there a default variable that can be used e.g. %USER%
would return: C:\Users\MyUsername | Use [`%HOMEPATH%`](http://environmentvariables.org/index.php?title=HomePath).
So:
```
CD %HOMEPATH%
``` |
1115508 | Batch / Find And Edit Lines in TXT file | 30 | 2009-07-12 07:53:53 | <p>I want to create a batch while which finds specific lines in a batch file and are able to edit these lines.</p>
<p>Example:</p>
<p>//TXT FILE//</p>
<pre><code>ex1
ex2
ex3
ex4
</code></pre>
<p>i want to let the batch file find 'ex3' and edit this to 'ex5' to let it look like this:</p>
<pre><code>ex1
ex2
ex5
ex4
... | 259,114 | 111,731 | 2021-02-19 04:21:07 | 1,115,567 | 31 | 2009-07-12 08:30:23 | 131,527 | 2018-11-02 15:01:55 | https://stackoverflow.com/q/1115508 | https://stackoverflow.com/a/1115567 | <p>On a native Windows install, you can either use batch(cmd.exe) or vbscript without the need to get external tools.
Here's an example in vbscript:</p>
<pre><code>Set objFS = CreateObject("Scripting.FileSystemObject")
strFile = "c:\test\file.txt"
Set objFile = objFS.OpenTextFile(strFile)
Do Until objFile.AtEndOfStrea... | <p>On a native Windows install, you can either use batch(cmd.exe) or vbscript without the need to get external tools. Here's an example in vbscript:</p> <pre><code>Set objFS = CreateObject("Scripting.FileSystemObject") strFile = "c:\test\file.txt" Set objFile = objFS.OpenTextFile(strFile) Do Until objFile.AtEndOfStrea... | 5826, 6366, 7002, 10193, 17938 | batch-file, edit, find, lines, text-files | <h1>Batch / Find And Edit Lines in TXT file</h1>
<p>I want to create a batch while which finds specific lines in a batch file and are able to edit these lines.</p>
<p>Example:</p>
<p>//TXT FILE//</p>
<pre><code>ex1
ex2
ex3
ex4
</code></pre>
<p>i want to let the batch file find 'ex3' and edit this to 'ex5' to let it... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,563 | cmd | # Batch / Find And Edit Lines in TXT file
I want to create a batch while which finds specific lines in a batch file and are able to edit these lines.
Example:
//TXT FILE//
```
ex1
ex2
ex3
ex4
```
i want to let the batch file find 'ex3' and edit this to 'ex5' to let it look like this:
```
ex1
ex2
ex5
ex4
``` | On a native Windows install, you can either use batch(cmd.exe) or vbscript without the need to get external tools.
Here's an example in vbscript:
```
Set objFS = CreateObject("Scripting.FileSystemObject")
strFile = "c:\test\file.txt"
Set objFile = objFS.OpenTextFile(strFile)
Do Until objFile.AtEndOfStream
strLine ... |
23160472 | Open chrome in windows from the command line in a new window | 20 | 2014-04-18 18:59:06 | <p>I tried this command from the cmd prompt:</p>
<pre><code>start "c:\program files (x86)\google\chrome\application\chrome.exe" --new-window "http://localhost:8080:/debug?port=5858"
</code></pre>
<p>and I get "windows can not find '--new-window'</p>
<p>If I remove the start command, it works fine. If I leave the st... | 61,790 | null | 2018-10-14 14:31:18 | 23,162,256 | 31 | 2014-04-18 21:00:21 | 1,335,801 | 2014-04-18 21:00:21 | https://stackoverflow.com/q/23160472 | https://stackoverflow.com/a/23162256 | <p>Answer is there : <a href="https://stackoverflow.com/questions/154075/using-the-dos-start-command-with-parameters-passed-to-the-started-program">Using the "start" command with parameters passed to the started program</a></p>
<pre><code>start "" "c:\program files (x86)\google\chrome\application\chrome.exe"... | <p>Answer is there : <a href="https://stackoverflow.com/questions/154075/using-the-dos-start-command-with-parameters-passed-to-the-started-program">Using the "start" command with parameters passed to the started program</a></p> <pre><code>start "" "c:\program files (x86)\google\chrome\application\chrome.exe"... | 64, 2631, 3600 | cmd, google-chrome, windows | <h1>Open chrome in windows from the command line in a new window</h1>
<p>I tried this command from the cmd prompt:</p>
<pre><code>start "c:\program files (x86)\google\chrome\application\chrome.exe" --new-window "http://localhost:8080:/debug?port=5858"
</code></pre>
<p>and I get "windows can not find '--new-window'</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,564 | cmd | # Open chrome in windows from the command line in a new window
I tried this command from the cmd prompt:
```
start "c:\program files (x86)\google\chrome\application\chrome.exe" --new-window "http://localhost:8080:/debug?port=5858"
```
and I get "windows can not find '--new-window'
If I remove the start command, it ... | Answer is there : [Using the "start" command with parameters passed to the started program](https://stackoverflow.com/questions/154075/using-the-dos-start-command-with-parameters-passed-to-the-started-program)
```
start "" "c:\program files (x86)\google\chrome\application\chrome.exe" --new-window "http://localhost:808... |
8756828 | Visual Studio Command Prompt gives "\Common was unexpected at this time" | 20 | 2012-01-06 11:00:56 | <p>I need to run MSBuild from the command line using the Visual Studio Command Prompt (2010). It used to work fine. Now when I open the window I get the following error message:</p>
<pre><code>\Common was unexpected at this time.
</code></pre>
<p>Trying to run the <code>msbuild</code> command after that fails. </p>
... | 21,832 | 486,840 | 2023-03-09 00:47:03 | 8,756,990 | 31 | 2012-01-06 11:15:01 | 293,974 | 2012-01-06 11:15:01 | https://stackoverflow.com/q/8756828 | https://stackoverflow.com/a/8756990 | <p>See <a href="http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/56bdd445-adc6-46ab-a383-6714bdb2030d/" rel="noreferrer">this</a> thread.</p>
<p>My guess is your <code>PATH</code> got modified recently and now contains some folder path with quotation marks inside.</p>
<p>HTH</p>
| <p>See <a href="http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/56bdd445-adc6-46ab-a383-6714bdb2030d/" rel="noreferrer">this</a> thread.</p> <p>My guess is your <code>PATH</code> got modified recently and now contains some folder path with quotation marks inside.</p> <p>HTH</p> | 7002, 14456, 33953 | batch-file, visual-studio, visual-studio-2010 | <h1>Visual Studio Command Prompt gives "\Common was unexpected at this time"</h1>
<p>I need to run MSBuild from the command line using the Visual Studio Command Prompt (2010). It used to work fine. Now when I open the window I get the following error message:</p>
<pre><code>\Common was unexpected at this time.
</code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,565 | cmd | # Visual Studio Command Prompt gives "\Common was unexpected at this time"
I need to run MSBuild from the command line using the Visual Studio Command Prompt (2010). It used to work fine. Now when I open the window I get the following error message:
```
\Common was unexpected at this time.
```
Trying to run the `msb... | See [this](http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/56bdd445-adc6-46ab-a383-6714bdb2030d/) thread.
My guess is your `PATH` got modified recently and now contains some folder path with quotation marks inside.
HTH |
10764920 | How to get a directory/file name with UTF-16 (Unicode) characters displayed correct by cmd.exe in command prompt window? | 19 | 2012-05-26 08:55:11 | <p>I've created the directory <code>•◘▬¨ŤlCęół♥☺☻0</code> and I would like to make it visible with the command <code>dir /b</code>. So far, the commands <code>chcp 10000</code>, <code>chcp 10001</code> and <code>chcp 65000</code> (UTF-7) failed.</p>
<p>The original name was displayed with:</p>
<blockquote>
<p>The syste... | 32,640 | 1,349,442 | 2025-07-08 17:23:02 | 10,765,469 | 31 | 2012-05-26 10:29:22 | 1,349,442 | 2012-09-16 16:45:11 | https://stackoverflow.com/q/10764920 | https://stackoverflow.com/a/10765469 | <p>Yeah,I've just resolved my problem. It was a fault of default font in cmd.exe which can't manage unicode signs. To fix it(windows 7 x64 pro):</p>
<ol>
<li>Open/run <code>cmd.exe</code></li>
<li>Click on the icon at the top-left corner</li>
<li>Select properties</li>
<li>Then "Font" bar</li>
<li>Select "Lucida Cons... | <p>Yeah,I've just resolved my problem. It was a fault of default font in cmd.exe which can't manage unicode signs. To fix it(windows 7 x64 pro):</p> <ol> <li>Open/run <code>cmd.exe</code></li> <li>Click on the icon at the top-left corner</li> <li>Select properties</li> <li>Then "Font" bar</li> <li>Select "Lucida Cons... | 64, 279, 2631 | cmd, unicode, windows | <h1>How to get a directory/file name with UTF-16 (Unicode) characters displayed correct by cmd.exe in command prompt window?</h1>
<p>I've created the directory <code>•◘▬¨ŤlCęół♥☺☻0</code> and I would like to make it visible with the command <code>dir /b</code>. So far, the commands <code>chcp 10000</code>, <code>chcp 1... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,566 | cmd | # How to get a directory/file name with UTF-16 (Unicode) characters displayed correct by cmd.exe in command prompt window?
I've created the directory `•◘▬¨ŤlCęół♥☺☻0` and I would like to make it visible with the command `dir /b`. So far, the commands `chcp 10000`, `chcp 10001` and `chcp 65000` (UTF-7) failed.
The ori... | Yeah,I've just resolved my problem. It was a fault of default font in cmd.exe which can't manage unicode signs. To fix it(windows 7 x64 pro):
1. Open/run `cmd.exe`
2. Click on the icon at the top-left corner
3. Select properties
4. Then "Font" bar
5. Select "Lucida Console" and OK.
6. Write `Chcp 10000` at the prompt
... |
28622523 | Windows CMD command for accessing usb? | 17 | 2015-02-20 05:56:52 | <p>I have tried googling it but couldn't find it. I know the command for it is cd /media for linux but have no idea what it is for Windows.I also tried the dir command but couldn't find anything related to media or usb.</p>
| 267,613 | 4,494,527 | 2025-04-26 23:27:54 | 28,622,800 | 31 | 2015-02-20 06:21:33 | 4,340,692 | 2015-02-20 06:21:33 | https://stackoverflow.com/q/28622523 | https://stackoverflow.com/a/28622800 | <p>You can access the USB drive by its drive letter. To know the drive letter you can run this command:</p>
<pre><code>C:\>wmic logicaldisk where drivetype=2 get deviceid, volumename, description
</code></pre>
<p>From here you will get the drive letter (Device ID) of your USB drive.</p>
<p>For example if its F: t... | <p>You can access the USB drive by its drive letter. To know the drive letter you can run this command:</p> <pre><code>C:\>wmic logicaldisk where drivetype=2 get deviceid, volumename, description </code></pre> <p>From here you will get the drive letter (Device ID) of your USB drive.</p> <p>For example if its F: t... | 2631 | cmd | <h1>Windows CMD command for accessing usb?</h1>
<p>I have tried googling it but couldn't find it. I know the command for it is cd /media for linux but have no idea what it is for Windows.I also tried the dir command but couldn't find anything related to media or usb.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,567 | cmd | # Windows CMD command for accessing usb?
I have tried googling it but couldn't find it. I know the command for it is cd /media for linux but have no idea what it is for Windows.I also tried the dir command but couldn't find anything related to media or usb. | You can access the USB drive by its drive letter. To know the drive letter you can run this command:
```
C:\>wmic logicaldisk where drivetype=2 get deviceid, volumename, description
```
From here you will get the drive letter (Device ID) of your USB drive.
For example if its F: then run the following command in comm... |
11845409 | if/then/else statements in Windows batch | 17 | 2012-08-07 11:55:01 | <p>In a shell script I have the following code:</p>
<pre><code>if echo Mr.32 ; then
echo Success
else
echo Failed
exit
fi
</code></pre>
<p>What is the equivalent syntax for Windows batch files?</p>
| 84,039 | 775,964 | 2012-08-08 11:10:23 | 11,849,558 | 31 | 2012-08-07 15:48:07 | 1,012,053 | 2012-08-08 11:10:23 | https://stackoverflow.com/q/11845409 | https://stackoverflow.com/a/11849558 | <p>I'm having a hard time envisioning when ECHO would fail with a returned ERRORLEVEL not equal 0. I suppose it could fail if the output has been redirected to a file and the target drive is full.</p>
<p>CptHammer has posted a good solution using ERRORLEVEL, although it uses GOTO unnecessarily. It can be done without ... | <p>I'm having a hard time envisioning when ECHO would fail with a returned ERRORLEVEL not equal 0. I suppose it could fail if the output has been redirected to a file and the target drive is full.</p> <p>CptHammer has posted a good solution using ERRORLEVEL, although it uses GOTO unnecessarily. It can be done without ... | 64, 7002 | batch-file, windows | <h1>if/then/else statements in Windows batch</h1>
<p>In a shell script I have the following code:</p>
<pre><code>if echo Mr.32 ; then
echo Success
else
echo Failed
exit
fi
</code></pre>
<p>What is the equivalent syntax for Windows batch files?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,568 | cmd | # if/then/else statements in Windows batch
In a shell script I have the following code:
```
if echo Mr.32 ; then
echo Success
else
echo Failed
exit
fi
```
What is the equivalent syntax for Windows batch files? | I'm having a hard time envisioning when ECHO would fail with a returned ERRORLEVEL not equal 0. I suppose it could fail if the output has been redirected to a file and the target drive is full.
CptHammer has posted a good solution using ERRORLEVEL, although it uses GOTO unnecessarily. It can be done without GOTO using... |
11137702 | "rd" exits with errorlevel set to 0 on error when deletion fails, etc | 17 | 2012-06-21 12:01:57 | <p>I'm writing a batch (.bat) script and I need to handle the case in which the deletion of a folder fails. I'm using <code>%errorlevel%</code> to catch the exit code, but in the case of the <code>rd</code> command it seems not to work:</p>
<pre><code>C:\Users\edo\Desktop>rd testdir
Directory is not empty
C:\Users... | 14,558 | 440,172 | 2019-05-21 14:18:16 | 11,137,825 | 31 | 2012-06-21 12:09:23 | 1,012,053 | 2019-05-21 14:18:16 | https://stackoverflow.com/q/11137702 | https://stackoverflow.com/a/11137825 | <p>Wow, this is the 2nd case I've seen where ERRORLEVEL is not set properly! See <a href="https://stackoverflow.com/q/10354016/1012053">File redirection in Windows and %errorlevel%</a>.</p>
<p>The solution is the same as for detecting redirection failure. Use the <code>||</code> operator to take action upon failure.</... | <p>Wow, this is the 2nd case I've seen where ERRORLEVEL is not set properly! See <a href="https://stackoverflow.com/q/10354016/1012053">File redirection in Windows and %errorlevel%</a>.</p> <p>The solution is the same as for detecting redirection failure. Use the <code>||</code> operator to take action upon failure.</... | 64, 379, 2631, 7002, 10021 | batch-file, cmd, error-handling, exit-code, windows | <h1>"rd" exits with errorlevel set to 0 on error when deletion fails, etc</h1>
<p>I'm writing a batch (.bat) script and I need to handle the case in which the deletion of a folder fails. I'm using <code>%errorlevel%</code> to catch the exit code, but in the case of the <code>rd</code> command it seems not to work:</p>
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,569 | cmd | # "rd" exits with errorlevel set to 0 on error when deletion fails, etc
I'm writing a batch (.bat) script and I need to handle the case in which the deletion of a folder fails. I'm using `%errorlevel%` to catch the exit code, but in the case of the `rd` command it seems not to work:
```
C:\Users\edo\Desktop>rd testdi... | Wow, this is the 2nd case I've seen where ERRORLEVEL is not set properly! See [File redirection in Windows and %errorlevel%](https://stackoverflow.com/q/10354016/1012053).
The solution is the same as for detecting redirection failure. Use the `||` operator to take action upon failure.
```
rd testdir || echo The comma... |
4147821 | Start a windows service and launch cmd | 16 | 2010-11-10 18:36:58 | <p>Do I need to enable Interactive desktp for it to work and what is the correct code to start an EXE or cmd window? I'm still unable to start the service even when I had enable it to interact with desktop.</p>
<p>I would be using an chat engine so it is easier to manage as a windows service. </p>
<p>What wrong with ... | 18,952 | 217,582 | 2022-01-20 09:12:25 | 4,147,868 | 31 | 2010-11-10 18:42:41 | 440,502 | 2022-01-20 09:12:25 | https://stackoverflow.com/q/4147821 | https://stackoverflow.com/a/4147868 | <p>I have gone through all the pain of doing this.</p>
<p>Under windows 7/Vista/2008 it is not possible to load any interactive process from a service - without calling a number of Win API. = BLACK MAGIC</p>
<p>Have a look <a href="https://learn.microsoft.com/en-us/archive/blogs/winsdk/launching-an-interactive-process-... | <p>I have gone through all the pain of doing this.</p> <p>Under windows 7/Vista/2008 it is not possible to load any interactive process from a service - without calling a number of Win API. = BLACK MAGIC</p> <p>Have a look <a href="https://learn.microsoft.com/en-us/archive/blogs/winsdk/launching-an-interactive-process-... | 9, 64, 2596, 2631 | c#, cmd, windows, windows-services | <h1>Start a windows service and launch cmd</h1>
<p>Do I need to enable Interactive desktp for it to work and what is the correct code to start an EXE or cmd window? I'm still unable to start the service even when I had enable it to interact with desktop.</p>
<p>I would be using an chat engine so it is easier to manage... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,570 | cmd | # Start a windows service and launch cmd
Do I need to enable Interactive desktp for it to work and what is the correct code to start an EXE or cmd window? I'm still unable to start the service even when I had enable it to interact with desktop.
I would be using an chat engine so it is easier to manage as a windows se... | I have gone through all the pain of doing this.
Under windows 7/Vista/2008 it is not possible to load any interactive process from a service - without calling a number of Win API. = BLACK MAGIC
Have a look [here](https://learn.microsoft.com/en-us/archive/blogs/winsdk/launching-an-interactive-process-from-windows-serv... |
1183659 | Windows advanced file matching | 16 | 2009-07-26 03:37:09 | <p>I'm trying to use a batch file to list files in a directory such that the file name only (minus extension) matches only numeric patterns, e.g. something like 125646543.pdf which would be easy to express as a regex [\d]+\.pdf but of course I don't have such niceties with Windows-only mechanisms... I'm trying to do th... | 34,248 | 120,818 | 2020-03-28 14:55:01 | 1,183,669 | 31 | 2009-07-26 03:45:32 | 14,860 | 2009-07-27 03:34:52 | https://stackoverflow.com/q/1183659 | https://stackoverflow.com/a/1183669 | <p><code>findstr</code> can do regexes under Windows just fine. I'd try:</p>
<pre><code>dir /b | findstr /i "^[0-9][0-9]*\.pdf$"
</code></pre>
<p>The <code>"dir /b"</code> gives you the filenames only, one per line. The regex matches one or more digits followed by a period followed by your desired extension. For any ... | <p><code>findstr</code> can do regexes under Windows just fine. I'd try:</p> <pre><code>dir /b | findstr /i "^[0-9][0-9]*\.pdf$" </code></pre> <p>The <code>"dir /b"</code> gives you the filenames only, one per line. The regex matches one or more digits followed by a period followed by your desired extension. For any ... | 18, 64, 7002 | batch-file, regex, windows | <h1>Windows advanced file matching</h1>
<p>I'm trying to use a batch file to list files in a directory such that the file name only (minus extension) matches only numeric patterns, e.g. something like 125646543.pdf which would be easy to express as a regex [\d]+\.pdf but of course I don't have such niceties with Window... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,571 | cmd | # Windows advanced file matching
I'm trying to use a batch file to list files in a directory such that the file name only (minus extension) matches only numeric patterns, e.g. something like 125646543.pdf which would be easy to express as a regex [\d]+\.pdf but of course I don't have such niceties with Windows-only me... | `findstr` can do regexes under Windows just fine. I'd try:
```
dir /b | findstr /i "^[0-9][0-9]*\.pdf$"
```
The `"dir /b"` gives you the filenames only, one per line. The regex matches one or more digits followed by a period followed by your desired extension. For any extension, you could do:
```
dir /b | findstr "^... |
9458870 | Automatically Resize Command Line Window on Windows | 15 | 2012-02-27 01:04:22 | <p>I'm writing a program in Python, the data I want it to show must be able to fit on the screen at the same time without needing to scroll around. The default command line size does not allow for this.</p>
<p>Is there any way to automatically resize a command line window in Python without creating a GUI? The program ... | 23,782 | 974,992 | 2023-02-16 21:21:18 | 38,620,748 | 31 | 2016-07-27 18:36:28 | 6,646,336 | 2022-07-27 16:36:13 | https://stackoverflow.com/q/9458870 | https://stackoverflow.com/a/38620748 | <pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
import os
os.system('mode con: cols=100 lines=40')
input("Press any key to continue...")
</code></pre>
| <pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3 import os os.system('mode con: cols=100 lines=40') input("Press any key to continue...") </code></pre> | 16, 64, 2631, 2939 | cmd, python, resize, windows | <h1>Automatically Resize Command Line Window on Windows</h1>
<p>I'm writing a program in Python, the data I want it to show must be able to fit on the screen at the same time without needing to scroll around. The default command line size does not allow for this.</p>
<p>Is there any way to automatically resize a comma... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,572 | cmd | # Automatically Resize Command Line Window on Windows
I'm writing a program in Python, the data I want it to show must be able to fit on the screen at the same time without needing to scroll around. The default command line size does not allow for this.
Is there any way to automatically resize a command line window i... | ```
#!/usr/bin/env python3
import os
os.system('mode con: cols=100 lines=40')
input("Press any key to continue...")
``` |
19581078 | When querying the registry from a batch file, can I query the Data? | 15 | 2013-10-25 04:25:30 | <p>I have the following query - </p>
<pre><code>@ECHO OFF
REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Flight Simulator\10.0" /v AppPath
PAUSE
</code></pre>
<p>This returns the Name, Type, and Data of the entry, as below - </p>
<pre><code>HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Fligh... | 27,253 | 2,755,744 | 2018-10-15 07:42:59 | 19,581,268 | 31 | 2013-10-25 04:46:02 | 2,098,699 | 2013-10-25 04:46:02 | https://stackoverflow.com/q/19581078 | https://stackoverflow.com/a/19581268 | <pre><code>for /f "tokens=2*" %%a in ('REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Flight Simulator\10.0" /v AppPath') do set "AppPath=%%~b"
echo %AppPath%
pause
</code></pre>
| <pre><code>for /f "tokens=2*" %%a in ('REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Flight Simulator\10.0" /v AppPath') do set "AppPath=%%~b" echo %AppPath% pause </code></pre> | 263, 7002 | batch-file, registry | <h1>When querying the registry from a batch file, can I query the Data?</h1>
<p>I have the following query - </p>
<pre><code>@ECHO OFF
REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Flight Simulator\10.0" /v AppPath
PAUSE
</code></pre>
<p>This returns the Name, Type, and Data of the entry, as below ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,573 | cmd | # When querying the registry from a batch file, can I query the Data?
I have the following query -
```
@ECHO OFF
REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Flight Simulator\10.0" /v AppPath
PAUSE
```
This returns the Name, Type, and Data of the entry, as below -
```
HKEY_CURRENT_USER\Software\M... | ```
for /f "tokens=2*" %%a in ('REG QUERY "HKEY_CURRENT_USER\Software\Microsoft\Microsoft Games\Flight Simulator\10.0" /v AppPath') do set "AppPath=%%~b"
echo %AppPath%
pause
``` |
6984732 | T-SQL, Insert into with MAX()+1 in subquery doesn't increment, alternatives? | 14 | 2011-08-08 15:42:56 | <p>I have a query where I need to "batch" insert rows into a table with a primary key without identity.</p>
<pre><code>--TableA
--PK int (Primary key, no-identity)
--CustNo int
INSERT INTO TableA (PK,CustNo)
SELECT (SELECT MAX(PK)+1 AS PK FROM TableA), CustNo
FROM Customers
</code></pre>
<p><em>(simplified exampl... | 43,503 | 725,297 | 2015-06-18 14:12:35 | 6,984,819 | 31 | 2011-08-08 15:50:30 | 11,432 | 2011-08-08 15:50:30 | https://stackoverflow.com/q/6984732 | https://stackoverflow.com/a/6984819 | <pre><code>Declare @i int;
Select @i = max(pk) + 1 from tablea;
INSERT INTO TableA (PK, custno)
Select row_number() over(order by custno) + @i , CustNo
FROM Customers
</code></pre>
| <pre><code>Declare @i int; Select @i = max(pk) + 1 from tablea; INSERT INTO TableA (PK, custno) Select row_number() over(order by custno) + @i , CustNo FROM Customers </code></pre> | 23, 72, 30408, 58566 | batch-insert, sql-server, sql-server-2008, t-sql | <h1>T-SQL, Insert into with MAX()+1 in subquery doesn't increment, alternatives?</h1>
<p>I have a query where I need to "batch" insert rows into a table with a primary key without identity.</p>
<pre><code>--TableA
--PK int (Primary key, no-identity)
--CustNo int
INSERT INTO TableA (PK,CustNo)
SELECT (SELECT MAX(PK)+... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,574 | cmd | # T-SQL, Insert into with MAX()+1 in subquery doesn't increment, alternatives?
I have a query where I need to "batch" insert rows into a table with a primary key without identity.
```
--TableA
--PK int (Primary key, no-identity)
--CustNo int
INSERT INTO TableA (PK,CustNo)
SELECT (SELECT MAX(PK)+1 AS PK FROM TableA)... | ```
Declare @i int;
Select @i = max(pk) + 1 from tablea;
INSERT INTO TableA (PK, custno)
Select row_number() over(order by custno) + @i , CustNo
FROM Customers
``` |
5183621 | How can I create an auto-executing, WinRar SFX file from a batch file? | 12 | 2011-03-03 16:34:52 | <p>I have a 3rd-party installer program that I would like for my users to be able to download and run as a pre-requisite to an application that I have written. The installer can take parameters that allows for a passive installation, where the user can watch the progress of the process but doesn't have to interact wit... | 29,826 | 469,319 | 2015-08-12 08:26:57 | 5,866,620 | 31 | 2011-05-03 07:50:30 | 630,388 | 2011-05-03 07:50:30 | https://stackoverflow.com/q/5183621 | https://stackoverflow.com/a/5866620 | <p>the easy way is like this:</p>
<pre><code>rar a -r -sfx -z"f:\xfs.conf" auto_install install_me.exe
</code></pre>
<p>It will automatically create auto_install.exe in windows.And you need to create a xfs.conf file for sfx configuration; My example is:</p>
<pre><code>; The path to the setup executable
Setup=install... | <p>the easy way is like this:</p> <pre><code>rar a -r -sfx -z"f:\xfs.conf" auto_install install_me.exe </code></pre> <p>It will automatically create auto_install.exe in windows.And you need to create a xfs.conf file for sfx configuration; My example is:</p> <pre><code>; The path to the setup executable Setup=install... | 488, 7002, 36386, 37612 | batch-file, console, sfx, winrar | <h1>How can I create an auto-executing, WinRar SFX file from a batch file?</h1>
<p>I have a 3rd-party installer program that I would like for my users to be able to download and run as a pre-requisite to an application that I have written. The installer can take parameters that allows for a passive installation, where... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,576 | cmd | # How can I create an auto-executing, WinRar SFX file from a batch file?
I have a 3rd-party installer program that I would like for my users to be able to download and run as a pre-requisite to an application that I have written. The installer can take parameters that allows for a passive installation, where the user ... | the easy way is like this:
```
rar a -r -sfx -z"f:\xfs.conf" auto_install install_me.exe
```
It will automatically create auto_install.exe in windows.And you need to create a xfs.conf file for sfx configuration; My example is:
```
; The path to the setup executable
Setup=install_me.exe
; Extract the files to a tempo... |
12629775 | Parsing string in batch file | 10 | 2012-09-27 20:47:45 | <p>I have the following string:</p>
<p><code>MyProject/Architecture=32bit,BuildType=Debug,OS=winpc</code></p>
<p>I would like to be able to grab the values 32bit, Debug, and winpc and store them in variables named Architecture, BuildType, and OS to reference later in the batch script. I'm normally a Unix guy so this... | 52,866 | 869,525 | 2018-11-12 13:19:41 | 12,629,915 | 31 | 2012-09-27 20:57:53 | 41,747 | 2012-09-27 20:57:53 | https://stackoverflow.com/q/12629775 | https://stackoverflow.com/a/12629915 | <p>This should do it:</p>
<pre><code>FOR /F "tokens=1-6 delims==," %%I IN ("MyProject/Architecture=32bit,BuildType=Debug,OS=winpc") DO (
ECHO I %%I, J %%J, K %%K, L %%L, M %%M, N %%N
)
REM output is: I MyProject/Architecture, J 32bit, K BuildType, L Debug, M OS, N winpc
</code></pre>
<p>The batch <code>FOR</code>... | <p>This should do it:</p> <pre><code>FOR /F "tokens=1-6 delims==," %%I IN ("MyProject/Architecture=32bit,BuildType=Debug,OS=winpc") DO ( ECHO I %%I, J %%J, K %%K, L %%L, M %%M, N %%N ) REM output is: I MyProject/Architecture, J 32bit, K BuildType, L Debug, M OS, N winpc </code></pre> <p>The batch <code>FOR</code>... | 64, 1357, 7002 | batch-file, parsing, windows | <h1>Parsing string in batch file</h1>
<p>I have the following string:</p>
<p><code>MyProject/Architecture=32bit,BuildType=Debug,OS=winpc</code></p>
<p>I would like to be able to grab the values 32bit, Debug, and winpc and store them in variables named Architecture, BuildType, and OS to reference later in the batch sc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,577 | cmd | # Parsing string in batch file
I have the following string:
`MyProject/Architecture=32bit,BuildType=Debug,OS=winpc`
I would like to be able to grab the values 32bit, Debug, and winpc and store them in variables named Architecture, BuildType, and OS to reference later in the batch script. I'm normally a Unix guy so t... | This should do it:
```
FOR /F "tokens=1-6 delims==," %%I IN ("MyProject/Architecture=32bit,BuildType=Debug,OS=winpc") DO (
ECHO I %%I, J %%J, K %%K, L %%L, M %%M, N %%N
)
REM output is: I MyProject/Architecture, J 32bit, K BuildType, L Debug, M OS, N winpc
```
The batch `FOR` loop is a pretty interesting piece of... |
17819814 | How can you get the clipboard contents with a Windows command? | 79 | 2013-07-23 19:54:57 | <p>For example, I can copy a file to the clipboard like this:</p>
<pre><code>clip < file.txt
</code></pre>
<p>(Now the contents of <code>file.txt</code> is in the clipboard.)</p>
<p>How can I do the opposite:</p>
<pre><code>???? > file.txt
</code></pre>
<p>So that the contents of the clipboard will be in <co... | 96,885 | 810,671 | 2025-05-30 12:01:59 | 17,819,928 | 30 | 2013-07-23 20:00:24 | 681,012 | 2013-07-23 20:00:24 | https://stackoverflow.com/q/17819814 | https://stackoverflow.com/a/17819928 | <p>You can use the paste.exe software in order to paste text just like you are describing. </p>
<p><a href="http://www.c3scripts.com/tutorials/msdos/paste.html">http://www.c3scripts.com/tutorials/msdos/paste.html</a></p>
<p>With it you can do:</p>
<pre><code>paste | command
</code></pre>
<p>to paste the contents of... | <p>You can use the paste.exe software in order to paste text just like you are describing. </p> <p><a href="http://www.c3scripts.com/tutorials/msdos/paste.html">http://www.c3scripts.com/tutorials/msdos/paste.html</a></p> <p>With it you can do:</p> <pre><code>paste | command </code></pre> <p>to paste the contents of... | 64, 524, 2631, 5098 | clipboard, cmd, copy-paste, windows | <h1>How can you get the clipboard contents with a Windows command?</h1>
<p>For example, I can copy a file to the clipboard like this:</p>
<pre><code>clip < file.txt
</code></pre>
<p>(Now the contents of <code>file.txt</code> is in the clipboard.)</p>
<p>How can I do the opposite:</p>
<pre><code>???? > file.tx... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,579 | cmd | # How can you get the clipboard contents with a Windows command?
For example, I can copy a file to the clipboard like this:
```
clip < file.txt
```
(Now the contents of `file.txt` is in the clipboard.)
How can I do the opposite:
```
???? > file.txt
```
So that the contents of the clipboard will be in `file.txt`? | You can use the paste.exe software in order to paste text just like you are describing.
<http://www.c3scripts.com/tutorials/msdos/paste.html>
With it you can do:
```
paste | command
```
to paste the contents of the windows clipboard into the input of the specified command prompt
or
```
paste > filename
```
to pa... |
25540502 | Use of multiple DataSources in Spring Batch | 54 | 2014-08-28 04:00:49 | <p>I am trying to configure a couple of datasources within Spring Batch. On startup, Spring Batch is throwing the following exception: </p>
<p><code>To use the default BatchConfigurer the context must contain no more thanone DataSource, found 2</code> </p>
<p>Snippet from Batch Configuration
</p>
<pre class="lang-... | 68,294 | 1,783,466 | 2021-05-12 20:42:52 | 29,165,232 | 30 | 2015-03-20 11:15:03 | 799,513 | 2017-03-22 14:20:45 | https://stackoverflow.com/q/25540502 | https://stackoverflow.com/a/29165232 | <p><a href="http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/configuration/annotation/AbstractBatchConfiguration.html" rel="noreferrer"><code>AbstractBatchConfiguration</code></a> tries to lookup <a href="http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/configuration/an... | <p><a href="http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/configuration/annotation/AbstractBatchConfiguration.html" rel="noreferrer"><code>AbstractBatchConfiguration</code></a> tries to lookup <a href="http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/configuration/an... | 17, 1211, 3512, 41895 | datasource, java, spring, spring-batch | <h1>Use of multiple DataSources in Spring Batch</h1>
<p>I am trying to configure a couple of datasources within Spring Batch. On startup, Spring Batch is throwing the following exception: </p>
<p><code>To use the default BatchConfigurer the context must contain no more thanone DataSource, found 2</code> </p>
<p>Sni... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,580 | cmd | # Use of multiple DataSources in Spring Batch
I am trying to configure a couple of datasources within Spring Batch. On startup, Spring Batch is throwing the following exception:
`To use the default BatchConfigurer the context must contain no more thanone DataSource, found 2`
Snippet from Batch Configuration
```
@Co... | [`AbstractBatchConfiguration`](http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/configuration/annotation/AbstractBatchConfiguration.html) tries to lookup [`BatchConfigurer`](http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/core/configuration/annotation/BatchConfigurer.html) ... |
20907206 | Could not open JPA EntityManager for transaction; nested exception is java.lang.IllegalStateException | 35 | 2014-01-03 15:35:23 | <p>I am quite new to Spring and Spring-Batch in particular.
Still I somehow managed to install the <strong>Spring Batch-Admin</strong>. I added custom jobs and <strong>Hibernate/JPA</strong> for persistence. </p>
<p>Everything is working as expected, up to the point where the first chunk should be persisted. Then I r... | 192,029 | 2,201,958 | 2021-11-30 11:50:46 | 20,961,958 | 30 | 2014-01-07 00:36:18 | 2,898,867 | 2021-11-30 11:50:46 | https://stackoverflow.com/q/20907206 | https://stackoverflow.com/a/20961958 | <p>The error comes from JpaTransactionManager line 403:</p>
<pre><code>TransactionSynchronizationManager.bindResource(getDataSource(), conHolder);
</code></pre>
<p>The error means that the transaction manager is trying to bind the <strong>datasource</strong> (not the entity manager) to the thread, but the datasource is... | <p>The error comes from JpaTransactionManager line 403:</p> <pre><code>TransactionSynchronizationManager.bindResource(getDataSource(), conHolder); </code></pre> <p>The error means that the transaction manager is trying to bind the <strong>datasource</strong> (not the entity manager) to the thread, but the datasource is... | 17, 1211, 2620, 2990, 41895 | hibernate, java, jpa, spring, spring-batch | <h1>Could not open JPA EntityManager for transaction; nested exception is java.lang.IllegalStateException</h1>
<p>I am quite new to Spring and Spring-Batch in particular.
Still I somehow managed to install the <strong>Spring Batch-Admin</strong>. I added custom jobs and <strong>Hibernate/JPA</strong> for persistence. ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,581 | cmd | # Could not open JPA EntityManager for transaction; nested exception is java.lang.IllegalStateException
I am quite new to Spring and Spring-Batch in particular.
Still I somehow managed to install the **Spring Batch-Admin**. I added custom jobs and **Hibernate/JPA** for persistence.
Everything is working as expected, ... | The error comes from JpaTransactionManager line 403:
```
TransactionSynchronizationManager.bindResource(getDataSource(), conHolder);
```
The error means that the transaction manager is trying to bind the **datasource** (not the entity manager) to the thread, but the datasource is already there and this is unexpected.... |
13398545 | String processing in windows batch files: How to pad value with leading zeros? | 34 | 2012-11-15 13:34:06 | <p>in a Windows cmd batch file (.bat), how do i pad a numeric value, so that a given value in the range 0..99 gets transformed to a string in the range "00" to "99". I.e. I'd like to having leading zeros for values lower than 10.</p>
| 53,652 | 756,290 | 2022-11-03 11:43:26 | 13,398,719 | 30 | 2012-11-15 13:43:29 | 50,079 | 2022-11-03 11:43:26 | https://stackoverflow.com/q/13398545 | https://stackoverflow.com/a/13398719 | <p>There's a two-stage process you can use:</p>
<pre><code>REM initial setup
SET X=5
REM pad with your desired width - 1 leading zeroes
SET PADDED=0%X%
REM slice off any zeroes you don't need -- BEWARE, this can truncate the value
REM the 2 at the end is the number of desired digits
SET PADDED=%PADDED:~-2%
</code></p... | <p>There's a two-stage process you can use:</p> <pre><code>REM initial setup SET X=5 REM pad with your desired width - 1 leading zeroes SET PADDED=0%X% REM slice off any zeroes you don't need -- BEWARE, this can truncate the value REM the 2 at the end is the number of desired digits SET PADDED=%PADDED:~-2% </code></p... | 64, 7002 | batch-file, windows | <h1>String processing in windows batch files: How to pad value with leading zeros?</h1>
<p>in a Windows cmd batch file (.bat), how do i pad a numeric value, so that a given value in the range 0..99 gets transformed to a string in the range "00" to "99". I.e. I'd like to having leading zeros for values lower than 10.</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,582 | cmd | # String processing in windows batch files: How to pad value with leading zeros?
in a Windows cmd batch file (.bat), how do i pad a numeric value, so that a given value in the range 0..99 gets transformed to a string in the range "00" to "99". I.e. I'd like to having leading zeros for values lower than 10. | There's a two-stage process you can use:
```
REM initial setup
SET X=5
REM pad with your desired width - 1 leading zeroes
SET PADDED=0%X%
REM slice off any zeroes you don't need -- BEWARE, this can truncate the value
REM the 2 at the end is the number of desired digits
SET PADDED=%PADDED:~-2%
```
Now `PADDED` holds... |
4643376 | How to split double quoted line into multiple lines in Windows batch file? | 34 | 2011-01-10 03:07:05 | <p>Long commands in Windows batch files can be split to multiple lines by using the <code>^</code> as mentioned in <a href="https://stackoverflow.com/questions/69068/">Long commands split over multiple lines in Windows Vista batch (.bat) file</a>.</p>
<p>However, if the caret is inside a double quoted string, it won't... | 17,926 | 76,705 | 2025-01-04 13:54:26 | 4,645,113 | 30 | 2011-01-10 09:05:19 | 463,115 | 2025-01-04 13:54:26 | https://stackoverflow.com/q/4643376 | https://stackoverflow.com/a/4645113 | <p>I see three possible workarounds.</p>
<p><strong>1) Building the line combining multiple for-parameters.</strong></p>
<pre><code>@echo off
SETLOCAL EnableDelayedExpansion
set "line="
for %%a in ("line1"
"line2"
"line3"
"line4"
) do set line=!line!%%~a
echo !line!
<... | <p>I see three possible workarounds.</p> <p><strong>1) Building the line combining multiple for-parameters.</strong></p> <pre><code>@echo off SETLOCAL EnableDelayedExpansion set "line=" for %%a in ("line1" "line2" "line3" "line4" ) do set line=!line!%%~a echo !line! <... | 7002 | batch-file | <h1>How to split double quoted line into multiple lines in Windows batch file?</h1>
<p>Long commands in Windows batch files can be split to multiple lines by using the <code>^</code> as mentioned in <a href="https://stackoverflow.com/questions/69068/">Long commands split over multiple lines in Windows Vista batch (.bat... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,583 | cmd | # How to split double quoted line into multiple lines in Windows batch file?
Long commands in Windows batch files can be split to multiple lines by using the `^` as mentioned in [Long commands split over multiple lines in Windows Vista batch (.bat) file](https://stackoverflow.com/questions/69068/).
However, if the ca... | I see three possible workarounds.
**1) Building the line combining multiple for-parameters.**
```
@echo off
SETLOCAL EnableDelayedExpansion
set "line="
for %%a in ("line1"
"line2"
"line3"
"line4"
) do set line=!line!%%~a
echo !line!
```
Drawback: It drops lines, when there is a `?` or `*` in the text.
**2) Leavin... |
7923948 | Batch Color per line | 26 | 2011-10-28 00:24:56 | <p>In batch, can you have different colors per line.
For example if you had a batch file say
"Hello"
"How are you?"</p>
<p>Could you have "Hello" in blue and "How are you" in green?</p>
<p>(I know about the color command, and the way it colors both the background and the text)</p>
| 77,620 | 983,122 | 2021-04-09 13:38:40 | 7,926,476 | 30 | 2011-10-28 07:48:38 | 487,650 | 2011-10-28 07:48:38 | https://stackoverflow.com/q/7923948 | https://stackoverflow.com/a/7926476 | <p>You can do it without any external program. Here is something that I came over a couple of days ago. Works very good.</p>
<pre><code>@echo off
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
echo say the name o... | <p>You can do it without any external program. Here is something that I came over a couple of days ago. Works very good.</p> <pre><code>@echo off SETLOCAL EnableDelayedExpansion for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do ( set "DEL=%%a" ) echo say the name o... | 7002 | batch-file | <h1>Batch Color per line</h1>
<p>In batch, can you have different colors per line.
For example if you had a batch file say
"Hello"
"How are you?"</p>
<p>Could you have "Hello" in blue and "How are you" in green?</p>
<p>(I know about the color command, and the way it colors both the background and the text)</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,584 | cmd | # Batch Color per line
In batch, can you have different colors per line.
For example if you had a batch file say
"Hello"
"How are you?"
Could you have "Hello" in blue and "How are you" in green?
(I know about the color command, and the way it colors both the background and the text) | You can do it without any external program. Here is something that I came over a couple of days ago. Works very good.
```
@echo off
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
echo say the name of the colors, don't re... |
17658354 | Mass rename of file extensions recursively (windows batch) | 24 | 2013-07-15 15:47:43 | <p>I have numerous files in a very complex directory structure, and for reasons not worth discussing I need to rename all files with the extension of ".inp" to have ".TXT" extensions. There are numerous other files with other extensions that I do not want to be touched, and I want to do it recursively down at least 5 l... | 38,599 | 1,014,679 | 2022-05-17 17:17:40 | 17,658,737 | 30 | 2013-07-15 16:07:16 | 2,128,947 | 2017-03-29 08:53:49 | https://stackoverflow.com/q/17658354 | https://stackoverflow.com/a/17658737 | <pre><code>for /r startdir %%i in (*.inp) do ECHO ren "%%i" "%%~ni.txt"
</code></pre>
<p>should work for you. Replace <code>startdir</code> with your starting directoryname and when you've checked this works to your satisfaction, remove the <code>echo</code> before the <code>ren</code> to actually do the rename.</p>
... | <pre><code>for /r startdir %%i in (*.inp) do ECHO ren "%%i" "%%~ni.txt" </code></pre> <p>should work for you. Replace <code>startdir</code> with your starting directoryname and when you've checked this works to your satisfaction, remove the <code>echo</code> before the <code>ren</code> to actually do the rename.</p> ... | 64, 578, 4510, 7002 | batch-file, recursion, rename, windows | <h1>Mass rename of file extensions recursively (windows batch)</h1>
<p>I have numerous files in a very complex directory structure, and for reasons not worth discussing I need to rename all files with the extension of ".inp" to have ".TXT" extensions. There are numerous other files with other extensions that I do not w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,585 | cmd | # Mass rename of file extensions recursively (windows batch)
I have numerous files in a very complex directory structure, and for reasons not worth discussing I need to rename all files with the extension of ".inp" to have ".TXT" extensions. There are numerous other files with other extensions that I do not want to be... | ```
for /r startdir %%i in (*.inp) do ECHO ren "%%i" "%%~ni.txt"
```
should work for you. Replace `startdir` with your starting directoryname and when you've checked this works to your satisfaction, remove the `echo` before the `ren` to actually do the rename.
---
For the downvoters: executing a batch file differs f... |
5006290 | For /f processing filename with spaces | 22 | 2011-02-15 16:20:20 | <p>I want to do some processing on each line of a file.</p>
<pre><code>for /f "delims=" %%i in ("%RF_PROPERTIES%") do (
echo %%i
)
</code></pre>
<p>My RF_PROPERTIES points to a file path with spaces (c:\program files\Arcot systems\conf\rf.properties). It is complaining saying Environment variable C:\Prog... | 24,862 | 474,323 | 2015-04-10 23:12:07 | 5,006,393 | 30 | 2011-02-15 16:28:03 | 369 | 2011-02-15 16:28:03 | https://stackoverflow.com/q/5006290 | https://stackoverflow.com/a/5006393 | <p>Try adding the <code>usebackq</code> option:</p>
<pre><code>for /f "usebackq delims=" %%i in ("%RF_PROPERTIES%") do (
echo %%i
)
</code></pre>
<p>Explanation from the output of <code>for /?</code>:</p>
<blockquote>
<p>usebackq - specifies that the
new semantics are in force,
... | <p>Try adding the <code>usebackq</code> option:</p> <pre><code>for /f "usebackq delims=" %%i in ("%RF_PROPERTIES%") do ( echo %%i ) </code></pre> <p>Explanation from the output of <code>for /?</code>:</p> <blockquote> <p>usebackq - specifies that the new semantics are in force, ... | 1062, 2531, 5310, 7002 | batch-file, file, filenames, for-loop | <h1>For /f processing filename with spaces</h1>
<p>I want to do some processing on each line of a file.</p>
<pre><code>for /f "delims=" %%i in ("%RF_PROPERTIES%") do (
echo %%i
)
</code></pre>
<p>My RF_PROPERTIES points to a file path with spaces (c:\program files\Arcot systems\conf\rf.properties). It is... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,586 | cmd | # For /f processing filename with spaces
I want to do some processing on each line of a file.
```
for /f "delims=" %%i in ("%RF_PROPERTIES%") do (
echo %%i
)
```
My RF_PROPERTIES points to a file path with spaces (c:\program files\Arcot systems\conf\rf.properties). It is complaining saying Environment v... | Try adding the `usebackq` option:
```
for /f "usebackq delims=" %%i in ("%RF_PROPERTIES%") do (
echo %%i
)
```
Explanation from the output of `for /?`:
> usebackq - specifies that the
> new semantics are in force,
> where a back quoted string is executed as a
> command and a single quoted string is a
> l... |
11711569 | Windows batch file - Concatenate all files in subdirectories | 21 | 2012-07-29 17:53:21 | <p>Need to concatenate all of the javascript files in a directory and all of its sub-directories into one file.</p>
<p>Right now I have a very simple command in a batch file that concatenates all of the matching files in one directory into one file:</p>
<pre><code>copy C:\javascripts\*.js concatenated.js
</code></pre... | 22,165 | 84,131 | 2013-03-20 19:40:24 | 11,711,831 | 30 | 2012-07-29 18:27:24 | 1,012,053 | 2013-03-20 19:40:24 | https://stackoverflow.com/q/11711569 | https://stackoverflow.com/a/11711831 | <p>From the command line you can use</p>
<pre><code>for /r "c:\javascripts" %F in (*.js) do @type "%F" >>concatenated.js
</code></pre>
<p>You might want want to first delete any existing concatenated.js before you run the above command.</p>
<p>From a batch file the percents need to be doubled</p>
<pre><code>@... | <p>From the command line you can use</p> <pre><code>for /r "c:\javascripts" %F in (*.js) do @type "%F" >>concatenated.js </code></pre> <p>You might want want to first delete any existing concatenated.js before you run the above command.</p> <p>From a batch file the percents need to be doubled</p> <pre><code>@... | 64, 7002 | batch-file, windows | <h1>Windows batch file - Concatenate all files in subdirectories</h1>
<p>Need to concatenate all of the javascript files in a directory and all of its sub-directories into one file.</p>
<p>Right now I have a very simple command in a batch file that concatenates all of the matching files in one directory into one file:... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,587 | cmd | # Windows batch file - Concatenate all files in subdirectories
Need to concatenate all of the javascript files in a directory and all of its sub-directories into one file.
Right now I have a very simple command in a batch file that concatenates all of the matching files in one directory into one file:
```
copy C:\ja... | From the command line you can use
```
for /r "c:\javascripts" %F in (*.js) do @type "%F" >>concatenated.js
```
You might want want to first delete any existing concatenated.js before you run the above command.
From a batch file the percents need to be doubled
```
@echo off
del concatenated.js
for /r "c:\javascripts... |
6444812 | Executing a Command from Java and Waiting for the Command to Finish | 20 | 2011-06-22 18:36:48 | <p>In my Java program, I create a process that executes a command to run a batch file like this:</p>
<pre><code>try {
File tempFile = new File("C:/Users/Public/temp.cmd");
tempFile.createNewFile();
tempFile.deleteOnExit();
setContents(tempFile, recipe.getText()); //Writes some user in... | 33,412 | 809,304 | 2017-02-08 06:58:30 | 6,496,032 | 30 | 2011-06-27 16:37:02 | 809,304 | 2013-07-30 11:21:29 | https://stackoverflow.com/q/6444812 | https://stackoverflow.com/a/6496032 | <p>I manged to find the answer elsewhere. To keep the initial process open until the batch file finished all you need is "/wait"</p>
<pre><code>Process p = Runtime.getRuntime().exec("cmd /C start /wait filepath.bat");
int exitVal = p.waitFor();
</code></pre>
| <p>I manged to find the answer elsewhere. To keep the initial process open until the batch file finished all you need is "/wait"</p> <pre><code>Process p = Runtime.getRuntime().exec("cmd /C start /wait filepath.bat"); int exitVal = p.waitFor(); </code></pre> | 17, 1796, 7002, 7382, 7932 | batch-file, command, exec, execute, java | <h1>Executing a Command from Java and Waiting for the Command to Finish</h1>
<p>In my Java program, I create a process that executes a command to run a batch file like this:</p>
<pre><code>try {
File tempFile = new File("C:/Users/Public/temp.cmd");
tempFile.createNewFile();
tempFile.deleteOnExi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,588 | cmd | # Executing a Command from Java and Waiting for the Command to Finish
In my Java program, I create a process that executes a command to run a batch file like this:
```
try {
File tempFile = new File("C:/Users/Public/temp.cmd");
tempFile.createNewFile();
tempFile.deleteOnExit();
setCo... | I manged to find the answer elsewhere. To keep the initial process open until the batch file finished all you need is "/wait"
```
Process p = Runtime.getRuntime().exec("cmd /C start /wait filepath.bat");
int exitVal = p.waitFor();
``` |
34402311 | Batch - What is the difference between CALL and GOTO? | 18 | 2015-12-21 18:42:54 | <p>I understand both link to labels in the code, but what is the difference?</p>
<pre><code>@echo off
:top
echo I love StackOverflow.com
goto :top
</code></pre>
<hr>
<pre><code>@echo off
:top
echo I love StackOverflow.com
call :top
</code></pre>
<p>Thank you in advance!</p>
| 23,985 | 4,306,308 | 2021-07-01 13:35:07 | 34,402,449 | 30 | 2015-12-21 18:52:17 | 5,699,173 | 2021-07-01 13:35:07 | https://stackoverflow.com/q/34402311 | https://stackoverflow.com/a/34402449 | <p>The example you gave won't really show the difference between the two.</p>
<ul>
<li><code>goto</code> - goes to the label.</li>
<li><code>call</code> - goes to the label and then returns to the caller when the code is complete.</li>
</ul>
<p>In your example, as your code is never complete, it never returns to the ca... | <p>The example you gave won't really show the difference between the two.</p> <ul> <li><code>goto</code> - goes to the label.</li> <li><code>call</code> - goes to the label and then returns to the caller when the code is complete.</li> </ul> <p>In your example, as your code is never complete, it never returns to the ca... | 3996, 7002, 8632 | batch-file, call, goto | <h1>Batch - What is the difference between CALL and GOTO?</h1>
<p>I understand both link to labels in the code, but what is the difference?</p>
<pre><code>@echo off
:top
echo I love StackOverflow.com
goto :top
</code></pre>
<hr>
<pre><code>@echo off
:top
echo I love StackOverflow.com
call :top
</code></pre>
<p>Than... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,589 | cmd | # Batch - What is the difference between CALL and GOTO?
I understand both link to labels in the code, but what is the difference?
```
@echo off
:top
echo I love StackOverflow.com
goto :top
```
---
```
@echo off
:top
echo I love StackOverflow.com
call :top
```
Thank you in advance! | The example you gave won't really show the difference between the two.
- `goto` - goes to the label.
- `call` - goes to the label and then returns to the caller when the code is complete.
In your example, as your code is never complete, it never returns to the caller.
The only difference you may see, is that the `ca... |
18758502 | Wait for multiple applications run asynchronously from batch file to finish | 18 | 2013-09-12 07:50:09 | <p>There is a simple Windows batch file that runs multiple instances of application:</p>
<pre><code>start app.exe param1
start app.exe param2
</code></pre>
<p>Is there a way to run them asynchronously at the same time (which above does) and wait for them both to finish to perform other actions - something like C# </p... | 22,344 | 80,733 | 2016-08-04 04:16:28 | 18,762,607 | 30 | 2013-09-12 11:09:36 | 1,012,053 | 2013-09-13 12:08:57 | https://stackoverflow.com/q/18758502 | https://stackoverflow.com/a/18762607 | <p>I suppose this question is slightly different than <a href="https://stackoverflow.com/q/12577442/1012053">Waiting for parallel batch scripts</a> in that this application is waiting for .exe processes to finish instead of batch scripts. But the solution is nearly identical.</p>
<p>You must instantiate some form of p... | <p>I suppose this question is slightly different than <a href="https://stackoverflow.com/q/12577442/1012053">Waiting for parallel batch scripts</a> in that this application is waiting for .exe processes to finish instead of batch scripts. But the solution is nearly identical.</p> <p>You must instantiate some form of p... | 7002, 7338, 21289 | batch-file, multiple-instances, wait | <h1>Wait for multiple applications run asynchronously from batch file to finish</h1>
<p>There is a simple Windows batch file that runs multiple instances of application:</p>
<pre><code>start app.exe param1
start app.exe param2
</code></pre>
<p>Is there a way to run them asynchronously at the same time (which above do... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,590 | cmd | # Wait for multiple applications run asynchronously from batch file to finish
There is a simple Windows batch file that runs multiple instances of application:
```
start app.exe param1
start app.exe param2
```
Is there a way to run them asynchronously at the same time (which above does) and wait for them both to fin... | I suppose this question is slightly different than [Waiting for parallel batch scripts](https://stackoverflow.com/q/12577442/1012053) in that this application is waiting for .exe processes to finish instead of batch scripts. But the solution is nearly identical.
You must instantiate some form of polling in your master... |
11170753 | Windows command interpreter: how to obtain exit code of first piped command | 18 | 2012-06-23 15:36:29 | <p>In the example provided below, I execute nmake and then redirect STDOUT/STDERR to tee, which then sends it to the screen, and also to a log file.
The problem is that I'm trying to capture the exit code for nmake and not tee.
What I need is the exit code from nmake, and not tee.</p>
<pre><code>nmake | tee output.txt... | 7,816 | 451,492 | 2021-02-19 22:16:18 | 11,178,012 | 30 | 2012-06-24 13:52:15 | 1,012,053 | 2019-06-07 12:44:31 | https://stackoverflow.com/q/11170753 | https://stackoverflow.com/a/11178012 | <p>You might think you could do something like the following, but it won't work.</p>
<pre><code>(nmake & call set myError=%%errorlevel%%) | tee output.txt
</code></pre>
<p>The problem lies in the mechanism by which Windows pipes work. Each side of the pipe is executed in it's own CMD shell. So any environment var... | <p>You might think you could do something like the following, but it won't work.</p> <pre><code>(nmake & call set myError=%%errorlevel%%) | tee output.txt </code></pre> <p>The problem lies in the mechanism by which Windows pipes work. Each side of the pipe is executed in it's own CMD shell. So any environment var... | 64, 2631, 5813, 10021 | cmd, exit-code, pipe, windows | <h1>Windows command interpreter: how to obtain exit code of first piped command</h1>
<p>In the example provided below, I execute nmake and then redirect STDOUT/STDERR to tee, which then sends it to the screen, and also to a log file.
The problem is that I'm trying to capture the exit code for nmake and not tee.
What I ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,591 | cmd | # Windows command interpreter: how to obtain exit code of first piped command
In the example provided below, I execute nmake and then redirect STDOUT/STDERR to tee, which then sends it to the screen, and also to a log file.
The problem is that I'm trying to capture the exit code for nmake and not tee.
What I need is t... | You might think you could do something like the following, but it won't work.
```
(nmake & call set myError=%%errorlevel%%) | tee output.txt
```
The problem lies in the mechanism by which Windows pipes work. Each side of the pipe is executed in it's own CMD shell. So any environment variable you set there will disapp... |
9160491 | Start multiple console apps from a batch file | 17 | 2012-02-06 13:01:49 | <p>I'm trying to run some console application .exe files from a batch file in Windows.</p>
<p>However, when I run the following code it only starts the first of the apps:</p>
<pre><code>"C:\Development\App\bin\Debug1\Application.exe"
timeout 5
"C:\Development\App\bin\Debug2\Application.exe"
timeout 5
"C:\Development\... | 22,967 | 509,555 | 2013-03-11 00:12:59 | 9,160,536 | 30 | 2012-02-06 13:05:39 | 14,860 | 2012-02-06 13:13:06 | https://stackoverflow.com/q/9160491 | https://stackoverflow.com/a/9160536 | <p>You can start applications in the background by using <code>start</code>:</p>
<pre><code>start "C:\Development\App\bin\Debug1\Application.exe"
</code></pre>
<p>Use <code>start /?</code> from a command window to get further details.</p>
<p>For example,</p>
<pre><code>start dir
</code></pre>
<p>will open a new co... | <p>You can start applications in the background by using <code>start</code>:</p> <pre><code>start "C:\Development\App\bin\Debug1\Application.exe" </code></pre> <p>Use <code>start /?</code> from a command window to get further details.</p> <p>For example,</p> <pre><code>start dir </code></pre> <p>will open a new co... | 488, 7002, 10631 | batch-file, console, console-application | <h1>Start multiple console apps from a batch file</h1>
<p>I'm trying to run some console application .exe files from a batch file in Windows.</p>
<p>However, when I run the following code it only starts the first of the apps:</p>
<pre><code>"C:\Development\App\bin\Debug1\Application.exe"
timeout 5
"C:\Development\App... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,592 | cmd | # Start multiple console apps from a batch file
I'm trying to run some console application .exe files from a batch file in Windows.
However, when I run the following code it only starts the first of the apps:
```
"C:\Development\App\bin\Debug1\Application.exe"
timeout 5
"C:\Development\App\bin\Debug2\Application.exe... | You can start applications in the background by using `start`:
```
start "C:\Development\App\bin\Debug1\Application.exe"
```
Use `start /?` from a command window to get further details.
For example,
```
start dir
```
will open a new command window and show you a directory listing, leaving it open when finsished.
... |
41355723 | What is this editor opened by "git commit --amend" in Windows 10 cmd and how do I use it? | 15 | 2016-12-28 05:13:34 | <p><a href="https://i.sstatic.net/Q5fej.png" rel="noreferrer"><img src="https://i.sstatic.net/Q5fej.png" alt="Editor opened by default when using "git commit --amend" in Windows 10 cmd."></a></p>
<p>Windows 10 cmd opens up this editor by default when I try to edit a GIT commit message. Can you please tell me... | 15,064 | 3,959,742 | 2021-10-23 22:35:17 | 41,356,410 | 30 | 2016-12-28 06:17:45 | 1,174,942 | 2018-03-24 12:49:35 | https://stackoverflow.com/q/41355723 | https://stackoverflow.com/a/41356410 | <p>It is <a href="https://en.wikipedia.org/wiki/Vim_(text_editor)" rel="noreferrer">Vim</a>, the default editor in Git installation. It is rather hard to use if you don't know how to use it! It is not trivial as other editors like Notepad++, Emacs or Sublime Text, though it is very powerful, and when you mastered it (i... | <p>It is <a href="https://en.wikipedia.org/wiki/Vim_(text_editor)" rel="noreferrer">Vim</a>, the default editor in Git installation. It is rather hard to use if you don't know how to use it! It is not trivial as other editors like Notepad++, Emacs or Sublime Text, though it is very powerful, and when you mastered it (i... | 64, 119, 370, 2631, 4893 | cmd, git, text-editor, vim, windows | <h1>What is this editor opened by "git commit --amend" in Windows 10 cmd and how do I use it?</h1>
<p><a href="https://i.sstatic.net/Q5fej.png" rel="noreferrer"><img src="https://i.sstatic.net/Q5fej.png" alt="Editor opened by default when using "git commit --amend" in Windows 10 cmd."></a></p>
<p>Windows 10 ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,593 | cmd | # What is this editor opened by "git commit --amend" in Windows 10 cmd and how do I use it?
[](https://i.sstatic.net/Q5fej.png)
Windows 10 cmd opens up this editor by default when I try to edit a GIT commit ... | It is [Vim](https://en.wikipedia.org/wiki/Vim_(text_editor)), the default editor in Git installation. It is rather hard to use if you don't know how to use it! It is not trivial as other editors like Notepad++, Emacs or Sublime Text, though it is very powerful, and when you mastered it (it takes a few month of hard wor... |
20214591 | SET JAVA_HOME in windows bat file not working | 15 | 2013-11-26 10:34:35 | <p>why is <strong>SET JAVA_HOME</strong> in this bat file not overriding the environment variable JAVA_HOME?</p>
<p><strong>someFile.bat</strong></p>
<pre><code>@ECHO OFF
SET JAVA_HOME = Progra~2\Java\jdk1.6.0_23
echo JAVA_HOME: %JAVA_HOME%
</code></pre>
<hr>
<p><strong>OUTPUT</strong></p>
<pre><code>JAVA_HOME: C:... | 68,262 | 955,732 | 2021-07-26 08:05:03 | 20,214,696 | 30 | 2013-11-26 10:39:18 | 388,389 | 2021-07-26 08:05:03 | https://stackoverflow.com/q/20214591 | https://stackoverflow.com/a/20214696 | <p>because of the additional space.Try this to see the value you've set:</p>
<pre><code>echo JAVA_HOME: %JAVA_HOME %
</code></pre>
<p>A robust way to set the java_home :</p>
<pre><code>SET "JAVA_HOME=Progra~2\Java\jdk1.6.0_23"
</code></pre>
| <p>because of the additional space.Try this to see the value you've set:</p> <pre><code>echo JAVA_HOME: %JAVA_HOME % </code></pre> <p>A robust way to set the java_home :</p> <pre><code>SET "JAVA_HOME=Progra~2\Java\jdk1.6.0_23" </code></pre> | 7002, 9013, 26220 | batch-file, environment-variables, java-home | <h1>SET JAVA_HOME in windows bat file not working</h1>
<p>why is <strong>SET JAVA_HOME</strong> in this bat file not overriding the environment variable JAVA_HOME?</p>
<p><strong>someFile.bat</strong></p>
<pre><code>@ECHO OFF
SET JAVA_HOME = Progra~2\Java\jdk1.6.0_23
echo JAVA_HOME: %JAVA_HOME%
</code></pre>
<hr>
<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,594 | cmd | # SET JAVA_HOME in windows bat file not working
why is **SET JAVA_HOME** in this bat file not overriding the environment variable JAVA_HOME?
**someFile.bat**
```
@ECHO OFF
SET JAVA_HOME = Progra~2\Java\jdk1.6.0_23
echo JAVA_HOME: %JAVA_HOME%
```
---
**OUTPUT**
```
JAVA_HOME: C:\Program Files (x86)\Java\jdk1.7.0_2... | because of the additional space.Try this to see the value you've set:
```
echo JAVA_HOME: %JAVA_HOME %
```
A robust way to set the java_home :
```
SET "JAVA_HOME=Progra~2\Java\jdk1.6.0_23"
``` |
18866381 | How can I run multiple commands in just one cmd windows in Java? | 15 | 2013-09-18 07:37:33 | <p>what I would like to do is run a <code>batch</code> file multiple times from a java application. Therefore I set up a <code>for-loop</code> that runs this code <code>n</code> times:</p>
<pre><code>for (int i = 0; i < n; i++) {
Runtime.getRuntime().exec("cmd /c start somefile.bat");
}
</code></pre>
<p>The pr... | 71,076 | 2,426,316 | 2020-10-30 00:35:39 | 18,867,097 | 30 | 2013-09-18 08:16:15 | 1,242,461 | 2013-09-18 08:24:20 | https://stackoverflow.com/q/18866381 | https://stackoverflow.com/a/18867097 | <p>With <strong>&&</strong> you can execute more than one commands, one after another:</p>
<pre><code>Runtime.getRuntime().exec("cmd /c \"start somefile.bat && start other.bat && cd C:\\test && test.exe\"");
</code></pre>
<blockquote>
<p><em>Using multiple commands and conditional pr... | <p>With <strong>&&</strong> you can execute more than one commands, one after another:</p> <pre><code>Runtime.getRuntime().exec("cmd /c \"start somefile.bat && start other.bat && cd C:\\test && test.exe\""); </code></pre> <blockquote> <p><em>Using multiple commands and conditional pr... | 17, 2531, 7002, 72972 | batch-file, for-loop, java, windows-runtime | <h1>How can I run multiple commands in just one cmd windows in Java?</h1>
<p>what I would like to do is run a <code>batch</code> file multiple times from a java application. Therefore I set up a <code>for-loop</code> that runs this code <code>n</code> times:</p>
<pre><code>for (int i = 0; i < n; i++) {
Runtime.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,595 | cmd | # How can I run multiple commands in just one cmd windows in Java?
what I would like to do is run a `batch` file multiple times from a java application. Therefore I set up a `for-loop` that runs this code `n` times:
```
for (int i = 0; i < n; i++) {
Runtime.getRuntime().exec("cmd /c start somefile.bat");
}
```
T... | With **&&** you can execute more than one commands, one after another:
```
Runtime.getRuntime().exec("cmd /c \"start somefile.bat && start other.bat && cd C:\\test && test.exe\"");
```
> *Using multiple commands and conditional processing symbols*
>
> You can run multiple commands from a single command line or script... |
37866312 | Spring Batch - Using an ItemWriter with List of Lists | 13 | 2016-06-16 18:01:23 | <p>Our processor returns a <code>List<?></code> (effectively passing a <code>List<List<?>></code>) to our <code>ItemWriter</code>. </p>
<p>Now, we observed that the <code>JdbcBatchItemWriter</code> is not programmed to handle <code>item instanceof List</code>. We also observed to process item instanc... | 26,524 | 2,681,760 | 2020-07-23 08:59:17 | 37,866,590 | 30 | 2016-06-16 18:18:31 | 6,215,069 | 2017-07-19 20:02:50 | https://stackoverflow.com/q/37866312 | https://stackoverflow.com/a/37866590 | <p>Typically, the design pattern is:</p>
<pre><code>Reader -> reads something, returns ReadItem
Processor -> ingests ReadItem, returns ProcessedItem
Writer -> ingests List<ProcessedItem>
</code></pre>
<p>If your processor is returning <code>List<Object></code>, then you need your Writer to expect... | <p>Typically, the design pattern is:</p> <pre><code>Reader -> reads something, returns ReadItem Processor -> ingests ReadItem, returns ProcessedItem Writer -> ingests List<ProcessedItem> </code></pre> <p>If your processor is returning <code>List<Object></code>, then you need your Writer to expect... | 17, 41895 | java, spring-batch | <h1>Spring Batch - Using an ItemWriter with List of Lists</h1>
<p>Our processor returns a <code>List<?></code> (effectively passing a <code>List<List<?>></code>) to our <code>ItemWriter</code>. </p>
<p>Now, we observed that the <code>JdbcBatchItemWriter</code> is not programmed to handle <code>item i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,596 | cmd | # Spring Batch - Using an ItemWriter with List of Lists
Our processor returns a `List<?>` (effectively passing a `List<List<?>>`) to our `ItemWriter`.
Now, we observed that the `JdbcBatchItemWriter` is not programmed to handle `item instanceof List`. We also observed to process item instanceof `List`; we need to writ... | Typically, the design pattern is:
```
Reader -> reads something, returns ReadItem
Processor -> ingests ReadItem, returns ProcessedItem
Writer -> ingests List<ProcessedItem>
```
If your processor is returning `List<Object>`, then you need your Writer to expect `List<List<Object>>`.
You could do this by wrapping your ... |
20470389 | How to get running applications in windows? | 13 | 2013-12-09 12:13:05 | <p>How can I get the list of currently running applications or foreground processes in Windows? </p>
<p>I mean the applications that have a window for real. Not the background services/processes.
I want to access the same list a task manager shows when we open it. </p>
<p>Is there a way?
Any type of solution is acce... | 29,708 | 1,600,122 | 2014-01-22 19:18:52 | 20,470,454 | 30 | 2013-12-09 12:16:04 | 1,952,580 | 2013-12-09 12:22:46 | https://stackoverflow.com/q/20470389 | https://stackoverflow.com/a/20470454 | <p>This may help:</p>
<pre><code>Process[] processes = Process.GetProcesses();
foreach(Process p in processes)
{
if(!String.IsNullOrEmpty(p.MainWindowTitle))
{
listBox1.Items.Add(p.MainWindowTitle);
}
}
</code></pre>
| <p>This may help:</p> <pre><code>Process[] processes = Process.GetProcesses(); foreach(Process p in processes) { if(!String.IsNullOrEmpty(p.MainWindowTitle)) { listBox1.Items.Add(p.MainWindowTitle); } } </code></pre> | 1, 9, 64, 2631, 5910 | .net, c#, cmd, process, windows | <h1>How to get running applications in windows?</h1>
<p>How can I get the list of currently running applications or foreground processes in Windows? </p>
<p>I mean the applications that have a window for real. Not the background services/processes.
I want to access the same list a task manager shows when we open it. <... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,597 | cmd | # How to get running applications in windows?
How can I get the list of currently running applications or foreground processes in Windows?
I mean the applications that have a window for real. Not the background services/processes.
I want to access the same list a task manager shows when we open it.
Is there a way?
A... | This may help:
```
Process[] processes = Process.GetProcesses();
foreach(Process p in processes)
{
if(!String.IsNullOrEmpty(p.MainWindowTitle))
{
listBox1.Items.Add(p.MainWindowTitle);
}
}
``` |
36147552 | What does %date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2% mean? | 12 | 2016-03-22 06:27:44 | <p>I have this part of script that create a variable called <code>fileName</code> used later to name a file.</p>
<pre><code>set fileName=db_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%.bak
</code></pre>
<p>What does <code>%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%</code> mean?</p>
| 85,662 | 3,696,822 | 2024-03-29 10:38:05 | 37,236,739 | 30 | 2016-05-15 09:44:31 | 3,074,564 | 2024-03-29 10:38:05 | https://stackoverflow.com/q/36147552 | https://stackoverflow.com/a/37236739 | <p>Opening a command prompt window and running there <code>set /?</code> outputs the help for command <strong>SET</strong>.</p>
<p>There is explained on last help page that <code>%DATE%</code> expands to the <strong>current locale date</strong> and <code>%TIME%</code> to the <strong>current locale time</strong> on pars... | <p>Opening a command prompt window and running there <code>set /?</code> outputs the help for command <strong>SET</strong>.</p> <p>There is explained on last help page that <code>%DATE%</code> expands to the <strong>current locale date</strong> and <code>%TIME%</code> to the <strong>current locale time</strong> on pars... | 64, 7002 | batch-file, windows | <h1>What does %date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2% mean?</h1>
<p>I have this part of script that create a variable called <code>fileName</code> used later to name a file.</p>
<pre><code>set fileName=db_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%.bak
</code></pre>
<p>What does ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,598 | cmd | # What does %date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2% mean?
I have this part of script that create a variable called `fileName` used later to name a file.
```
set fileName=db_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%.bak
```
What does `%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time... | Opening a command prompt window and running there `set /?` outputs the help for command **SET**.
There is explained on last help page that `%DATE%` expands to the **current locale date** and `%TIME%` to the **current locale time** on parsing the line containing those **dynamic** variable references.
The format of the... |
26246867 | 'ping' is not recognized as an internal or external command operable program or batch file error | 12 | 2014-10-07 23:24:39 | <p>When I do <code>ping www.google.com</code> I get the error message</p>
<blockquote>
<p>'ping' is not recognized as an internal or external command operable program or batch file.</p>
</blockquote>
<p>Here is an example:</p>
<p><img src="https://i.sstatic.net/NTKsO.png" alt="Command Prompt Ping" /></p>
<p>Then:</p>
<... | 63,754 | 3,204,869 | 2021-06-21 23:03:26 | 26,246,992 | 30 | 2014-10-07 23:37:58 | 4,096,939 | 2020-11-10 01:45:25 | https://stackoverflow.com/q/26246867 | https://stackoverflow.com/a/26246992 | <p>Most likely something has removed the system32 directory from your path. Have you installed the Java SDK? It has a reputation for doing that.</p>
<p>To check this, at the command prompt type <code>path</code> (followed by enter)</p>
<p>If c:\windows\system32 isn't there, it needs to be added back in. To do this:</p>... | <p>Most likely something has removed the system32 directory from your path. Have you installed the Java SDK? It has a reputation for doing that.</p> <p>To check this, at the command prompt type <code>path</code> (followed by enter)</p> <p>If c:\windows\system32 isn't there, it needs to be added back in. To do this:</p>... | 64, 5649, 7002, 9938, 19886 | batch-file, command-prompt, ping, system32, windows | <h1>'ping' is not recognized as an internal or external command operable program or batch file error</h1>
<p>When I do <code>ping www.google.com</code> I get the error message</p>
<blockquote>
<p>'ping' is not recognized as an internal or external command operable program or batch file.</p>
</blockquote>
<p>Here is an ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,599 | cmd | # 'ping' is not recognized as an internal or external command operable program or batch file error
When I do `ping www.google.com` I get the error message
> 'ping' is not recognized as an internal or external command operable program or batch file.
Here is an example:

If c:\windows\system32 isn't there, it needs to be added back in. To do this:
```
From the desktop, Right ... |
3472631 | How do I get the day month and year from a Windows cmd.exe script? | 53 | 2010-08-12 22:49:45 | <p>How do I get the current day month and year from inside a Windows cmd script? I need to get each value into a separate variable.</p>
| 217,858 | 188,204 | 2021-04-21 21:10:26 | 3,475,477 | 29 | 2010-08-13 09:18:53 | 359,381 | 2013-01-18 12:55:09 | https://stackoverflow.com/q/3472631 | https://stackoverflow.com/a/3475477 | <p>A variant of script that works locale-independently. Put it in a text file with .cmd extension and run.</p>
<pre><code>::: Begin set date
for /f "tokens=1-4 delims=/-. " %%i in ('date /t') do (call :set_date %%i %%j %%k %%l)
goto :end_set_date
:set_date
if "%1:~0,1%" gtr "9" shift
for /f "skip=1 tokens=2-4 delims... | <p>A variant of script that works locale-independently. Put it in a text file with .cmd extension and run.</p> <pre><code>::: Begin set date for /f "tokens=1-4 delims=/-. " %%i in ('date /t') do (call :set_date %%i %%j %%k %%l) goto :end_set_date :set_date if "%1:~0,1%" gtr "9" shift for /f "skip=1 tokens=2-4 delims... | 531, 2631, 5002 | cmd, date, scripting | <h1>How do I get the day month and year from a Windows cmd.exe script?</h1>
<p>How do I get the current day month and year from inside a Windows cmd script? I need to get each value into a separate variable.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,600 | cmd | # How do I get the day month and year from a Windows cmd.exe script?
How do I get the current day month and year from inside a Windows cmd script? I need to get each value into a separate variable. | A variant of script that works locale-independently. Put it in a text file with .cmd extension and run.
```
::: Begin set date
for /f "tokens=1-4 delims=/-. " %%i in ('date /t') do (call :set_date %%i %%j %%k %%l)
goto :end_set_date
:set_date
if "%1:~0,1%" gtr "9" shift
for /f "skip=1 tokens=2-4 delims=(-)" %%m in (... |
3001999 | How to remove trailing and leading whitespace for user-provided input in a batch file? | 49 | 2010-06-08 23:06:53 | <p>I know how to do this when the variable is pre-defined. However, when asking for the user to enter in some kind of input, how do I trim leading and trailing whitespace? This is what I have so far:</p>
<pre><code>@echo off
set /p input=:
echo. The input is %input% before
::trim left whitespace
for /f "tokens=* del... | 191,059 | 361,887 | 2025-11-30 16:08:20 | 3,002,207 | 29 | 2010-06-08 23:52:55 | 302,103 | 2010-06-08 23:52:55 | https://stackoverflow.com/q/3001999 | https://stackoverflow.com/a/3002207 | <p>You need to enable delayed expansion. Try this:</p>
<pre><code>@echo off
setlocal enabledelayedexpansion
:blah
set /p input=:
echo."%input%"
for /f "tokens=* delims= " %%a in ("%input%") do set input=%%a
for /l %%a in (1,1,100) do if "!input:~-1!"==" " set input=!input:~0,-1!
echo."%input%"
pause
goto blah
</code>... | <p>You need to enable delayed expansion. Try this:</p> <pre><code>@echo off setlocal enabledelayedexpansion :blah set /p input=: echo."%input%" for /f "tokens=* delims= " %%a in ("%input%") do set input=%%a for /l %%a in (1,1,100) do if "!input:~-1!"==" " set input=!input:~0,-1! echo."%input%" pause goto blah </code>... | 1084, 5486, 5641, 7002 | batch-file, input, trim, whitespace | <h1>How to remove trailing and leading whitespace for user-provided input in a batch file?</h1>
<p>I know how to do this when the variable is pre-defined. However, when asking for the user to enter in some kind of input, how do I trim leading and trailing whitespace? This is what I have so far:</p>
<pre><code>@echo of... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,601 | cmd | # How to remove trailing and leading whitespace for user-provided input in a batch file?
I know how to do this when the variable is pre-defined. However, when asking for the user to enter in some kind of input, how do I trim leading and trailing whitespace? This is what I have so far:
```
@echo off
set /p input=:
ec... | You need to enable delayed expansion. Try this:
```
@echo off
setlocal enabledelayedexpansion
:blah
set /p input=:
echo."%input%"
for /f "tokens=* delims= " %%a in ("%input%") do set input=%%a
for /l %%a in (1,1,100) do if "!input:~-1!"==" " set input=!input:~0,-1!
echo."%input%"
pause
goto blah
``` |
21530112 | No matter what, I can't batch MySQL INSERT statements in Hibernate | 34 | 2014-02-03 14:37:43 | <p>I'm currently facing the well-known and common Hibernate insert batch problem.</p>
<p>I need to save batches 5 millions of rows long. I'm first trying with a much lighter payload. Since I have to insert entities of only 2 types (first all records of type A, then all records of type B, all pointing to common type C ... | 11,823 | 471,213 | 2016-01-27 23:58:52 | 21,587,949 | 29 | 2014-02-05 20:36:12 | 3,263,183 | 2014-02-05 20:36:12 | https://stackoverflow.com/q/21530112 | https://stackoverflow.com/a/21587949 | <p>It's likely your queries are being rewritten but you wouldn't know if by looking at the Hibernate SQL logs. Hibernate does not rewrite the insert statements - the MySQL driver rewrites them. In other words, Hibernate will send multiple insert statements to the driver, and then the driver will rewrite them. So the... | <p>It's likely your queries are being rewritten but you wouldn't know if by looking at the Hibernate SQL logs. Hibernate does not rewrite the insert statements - the MySQL driver rewrites them. In other words, Hibernate will send multiple insert statements to the driver, and then the driver will rewrite them. So the... | 17, 21, 2620, 5617, 30645 | batch-processing, hibernate, java, jdbc, mysql | <h1>No matter what, I can't batch MySQL INSERT statements in Hibernate</h1>
<p>I'm currently facing the well-known and common Hibernate insert batch problem.</p>
<p>I need to save batches 5 millions of rows long. I'm first trying with a much lighter payload. Since I have to insert entities of only 2 types (first all r... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,602 | cmd | # No matter what, I can't batch MySQL INSERT statements in Hibernate
I'm currently facing the well-known and common Hibernate insert batch problem.
I need to save batches 5 millions of rows long. I'm first trying with a much lighter payload. Since I have to insert entities of only 2 types (first all records of type A... | It's likely your queries are being rewritten but you wouldn't know if by looking at the Hibernate SQL logs. Hibernate does not rewrite the insert statements - the MySQL driver rewrites them. In other words, Hibernate will send multiple insert statements to the driver, and then the driver will rewrite them. So the Hiber... |
6832203 | Access clipboard in Windows batch file | 34 | 2011-07-26 15:06:09 | <p>Any idea how to access the Windows clipboard using a batch file?</p>
| 62,173 | 836,041 | 2024-11-11 04:12:07 | 15,747,067 | 29 | 2013-04-01 16:15:01 | 1,683,264 | 2017-05-12 12:13:56 | https://stackoverflow.com/q/6832203 | https://stackoverflow.com/a/15747067 | <p>To set the contents of the clipboard, as Chris Thornton, klaatu, and <a href="https://www.google.com/search?q=windows%20clipboard%20command%20line" rel="noreferrer">bunches of others</a> have said, use <code>%windir%\system32\clip.exe</code>.</p>
<hr />
<h3>Update 2:</h3>
<p>For a quick one-liner, you could do somet... | <p>To set the contents of the clipboard, as Chris Thornton, klaatu, and <a href="https://www.google.com/search?q=windows%20clipboard%20command%20line" rel="noreferrer">bunches of others</a> have said, use <code>%windir%\system32\clip.exe</code>.</p> <hr /> <h3>Update 2:</h3> <p>For a quick one-liner, you could do somet... | 64, 524, 7002 | batch-file, clipboard, windows | <h1>Access clipboard in Windows batch file</h1>
<p>Any idea how to access the Windows clipboard using a batch file?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,603 | cmd | # Access clipboard in Windows batch file
Any idea how to access the Windows clipboard using a batch file? | To set the contents of the clipboard, as Chris Thornton, klaatu, and [bunches of others](https://www.google.com/search?q=windows%20clipboard%20command%20line) have said, use `%windir%\system32\clip.exe`.
---
### Update 2:
For a quick one-liner, you could do something like this:
```
powershell -sta "add-type -as Sys... |
778135 | How do I get the equivalent of dirname() in a batch file? | 34 | 2009-04-22 16:36:36 | <p>I'd like to get the parent directory of a file from within a <code>.bat</code> file. So, given a variable set to <code>"C:\MyDir\MyFile.txt"</code>, I'd like to get <code>"C:\MyDir"</code>. In other words, the equivalent of <code>dirname()</code> functionality in a typical UNIX environment. Is this possible?</p>
| 42,228 | 71,949 | 2022-04-27 20:46:18 | 778,147 | 29 | 2009-04-22 16:38:42 | 73,070 | 2009-04-22 19:45:20 | https://stackoverflow.com/q/778135 | https://stackoverflow.com/a/778147 | <pre><code>for %%F in (%filename%) do set dirname=%%~dpF
</code></pre>
<p>This will set <code>%dirname%</code> to the drive and directory of the file name stored in <code>%filename%</code>.</p>
<p>Careful with filenames containing spaces, though. Either they have to be set with surrounding quotes:</p>
<pre><code>set... | <pre><code>for %%F in (%filename%) do set dirname=%%~dpF </code></pre> <p>This will set <code>%dirname%</code> to the drive and directory of the file name stored in <code>%filename%</code>.</p> <p>Careful with filenames containing spaces, though. Either they have to be set with surrounding quotes:</p> <pre><code>set... | 64, 1231, 7002 | batch-file, command-line, windows | <h1>How do I get the equivalent of dirname() in a batch file?</h1>
<p>I'd like to get the parent directory of a file from within a <code>.bat</code> file. So, given a variable set to <code>"C:\MyDir\MyFile.txt"</code>, I'd like to get <code>"C:\MyDir"</code>. In other words, the equivalent of <code>dirname()</code> fun... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,604 | cmd | # How do I get the equivalent of dirname() in a batch file?
I'd like to get the parent directory of a file from within a `.bat` file. So, given a variable set to `"C:\MyDir\MyFile.txt"`, I'd like to get `"C:\MyDir"`. In other words, the equivalent of `dirname()` functionality in a typical UNIX environment. Is this pos... | ```
for %%F in (%filename%) do set dirname=%%~dpF
```
This will set `%dirname%` to the drive and directory of the file name stored in `%filename%`.
Careful with filenames containing spaces, though. Either they have to be set with surrounding quotes:
```
set filename="C:\MyDir\MyFile with space.txt"
```
or you have ... |
32979783 | How to override the CMD command in the docker run line | 32 | 2015-10-06 21:08:15 | <p>How you can replace the cmd based on the docker documentation:
<a href="https://docs.docker.com/engine/reference/builder/#cmd" rel="nofollow noreferrer">https://docs.docker.com/engine/reference/builder/#cmd</a></p>
<p>You can override the CMD command</p>
<p>Dockerfile:</p>
<pre><code>RUN chmod +x /srv/www/bin/* &... | 53,384 | 4,767,208 | 2024-04-17 17:27:46 | 32,979,784 | 29 | 2015-10-06 21:08:15 | 4,767,208 | 2015-10-06 21:21:36 | https://stackoverflow.com/q/32979783 | https://stackoverflow.com/a/32979784 | <p>The right way to do it is deleting cmd ["..."]</p>
<pre><code> docker run --name test test/test-backend /srv/www/bin/gunicorn.sh
</code></pre>
| <p>The right way to do it is deleting cmd ["..."]</p> <pre><code> docker run --name test test/test-backend /srv/www/bin/gunicorn.sh </code></pre> | 90304, 108477, 164539 | docker, docker-cmd, dockerfile | <h1>How to override the CMD command in the docker run line</h1>
<p>How you can replace the cmd based on the docker documentation:
<a href="https://docs.docker.com/engine/reference/builder/#cmd" rel="nofollow noreferrer">https://docs.docker.com/engine/reference/builder/#cmd</a></p>
<p>You can override the CMD command</p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,605 | cmd | # How to override the CMD command in the docker run line
How you can replace the cmd based on the docker documentation:
<https://docs.docker.com/engine/reference/builder/#cmd>
You can override the CMD command
Dockerfile:
```
RUN chmod +x /srv/www/bin/* & chmod -R 755 /srv/www/app
RUN pip3 install -r /srv/www/app/pi... | The right way to do it is deleting cmd ["..."]
```
docker run --name test test/test-backend /srv/www/bin/gunicorn.sh
``` |
9661381 | How to sort the tasklist in the command prompt? | 31 | 2012-03-12 03:22:19 | <p>I just wanted to know how to make the MEMUSAGE column be in decreasing or increasing order. I searched all over the web and still did not find the answer, the closest point I got was this:</p>
<pre><code>tasklist | sort
</code></pre>
<p>But when I try to use the /m for sort...:</p>
<pre><code>tasklist | sort /m
I... | 87,464 | 996,427 | 2024-11-01 15:12:04 | 9,661,411 | 29 | 2012-03-12 03:27:24 | 348,785 | 2021-08-29 10:34:40 | https://stackoverflow.com/q/9661381 | https://stackoverflow.com/a/9661411 | <pre><code>C:\> tasklist | sort /R /+58
</code></pre>
<p>The magic number <code>58</code> depend on your output.<br />
Sorts the file according to characters in column <code>58</code>(No guarantee!).</p>
<p>Note:
I also have demand to sort TASKLIST by the column "Mem Usage".
It is a bit tired to me when so... | <pre><code>C:\> tasklist | sort /R /+58 </code></pre> <p>The magic number <code>58</code> depend on your output.<br /> Sorts the file according to characters in column <code>58</code>(No guarantee!).</p> <p>Note: I also have demand to sort TASKLIST by the column "Mem Usage". It is a bit tired to me when so... | 134, 2631, 9647 | cmd, sorting, tasklist | <h1>How to sort the tasklist in the command prompt?</h1>
<p>I just wanted to know how to make the MEMUSAGE column be in decreasing or increasing order. I searched all over the web and still did not find the answer, the closest point I got was this:</p>
<pre><code>tasklist | sort
</code></pre>
<p>But when I try to use... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,606 | cmd | # How to sort the tasklist in the command prompt?
I just wanted to know how to make the MEMUSAGE column be in decreasing or increasing order. I searched all over the web and still did not find the answer, the closest point I got was this:
```
tasklist | sort
```
But when I try to use the /m for sort...:
```
tasklis... | ```
C:\> tasklist | sort /R /+58
```
The magic number `58` depend on your output.
Sorts the file according to characters in column `58`(No guarantee!).
Note:
I also have demand to sort TASKLIST by the column "Mem Usage".
It is a bit tired to me when sorting not friendly by nth column, it is n character
On my compu... |
3262287 | Make an environment variable survive ENDLOCAL | 30 | 2010-07-16 05:59:50 | <p>I have a batch file that computes a variable via a series of intermediate variables:</p>
<pre><code>@echo off
setlocal
set base=compute directory
set pkg=compute sub-directory
set scripts=%base%\%pkg%\Scripts
endlocal
%scripts%\activate.bat
</code></pre>
<p>The script on the last line isn't called, because it c... | 23,538 | 9,990 | 2019-05-22 09:28:05 | 8,254,331 | 29 | 2011-11-24 08:54:36 | 1,012,053 | 2017-08-22 16:01:06 | https://stackoverflow.com/q/3262287 | https://stackoverflow.com/a/8254331 | <p>The <code>ENDLOCAL & SET VAR=%TEMPVAR%</code> pattern is classic. But there are situations where it is not ideal.</p>
<p>If you do not know the contents of TEMPVAR, then you might run into problems if the value contains special characters like <code><</code> <code>></code> <code>&</code> or<code>|</co... | <p>The <code>ENDLOCAL & SET VAR=%TEMPVAR%</code> pattern is classic. But there are situations where it is not ideal.</p> <p>If you do not know the contents of TEMPVAR, then you might run into problems if the value contains special characters like <code><</code> <code>></code> <code>&</code> or<code>|</co... | 7002, 9013 | batch-file, environment-variables | <h1>Make an environment variable survive ENDLOCAL</h1>
<p>I have a batch file that computes a variable via a series of intermediate variables:</p>
<pre><code>@echo off
setlocal
set base=compute directory
set pkg=compute sub-directory
set scripts=%base%\%pkg%\Scripts
endlocal
%scripts%\activate.bat
</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 | 12,607 | cmd | # Make an environment variable survive ENDLOCAL
I have a batch file that computes a variable via a series of intermediate variables:
```
@echo off
setlocal
set base=compute directory
set pkg=compute sub-directory
set scripts=%base%\%pkg%\Scripts
endlocal
%scripts%\activate.bat
```
The script on the last line isn'... | The `ENDLOCAL & SET VAR=%TEMPVAR%` pattern is classic. But there are situations where it is not ideal.
If you do not know the contents of TEMPVAR, then you might run into problems if the value contains special characters like `<` `>` `&` or`|`. You can generally protect against that by using quotes like `SET "VAR=%TEM... |
44243608 | Need to insert 100000 rows in mysql using hibernate in under 5 seconds | 26 | 2017-05-29 13:24:08 | <p>I am trying to insert 100,000 rows in a MYSQL table under 5 seconds using Hibernate(JPA). I have tried every trick hibernate offers and still can not do better than 35 seconds. </p>
<p>1st optimisation : I started with IDENTITY sequence generator which was resulting in 60 seconds to insert. I later abandoned the s... | 36,097 | 153,940 | 2021-06-21 16:58:22 | 44,266,415 | 29 | 2017-05-30 15:34:11 | 153,940 | 2017-05-30 15:55:19 | https://stackoverflow.com/q/44243608 | https://stackoverflow.com/a/44266415 | <p>After trying all possible solutions I finally found a solution to insert 100,000 rows under 5 seconds!</p>
<p>Things I tried:</p>
<p>1) Replaced hibernate/database's AUTOINCREMENT/GENERATED id's by self generated ID's using AtomicInteger</p>
<p>2) Enabling batch_inserts with batch_size=50</p>
<p>3) Flushing cach... | <p>After trying all possible solutions I finally found a solution to insert 100,000 rows under 5 seconds!</p> <p>Things I tried:</p> <p>1) Replaced hibernate/database's AUTOINCREMENT/GENERATED id's by self generated ID's using AtomicInteger</p> <p>2) Enabling batch_inserts with batch_size=50</p> <p>3) Flushing cach... | 17, 21, 2620, 2990, 58566 | batch-insert, hibernate, java, jpa, mysql | <h1>Need to insert 100000 rows in mysql using hibernate in under 5 seconds</h1>
<p>I am trying to insert 100,000 rows in a MYSQL table under 5 seconds using Hibernate(JPA). I have tried every trick hibernate offers and still can not do better than 35 seconds. </p>
<p>1st optimisation : I started with IDENTITY sequenc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,608 | cmd | # Need to insert 100000 rows in mysql using hibernate in under 5 seconds
I am trying to insert 100,000 rows in a MYSQL table under 5 seconds using Hibernate(JPA). I have tried every trick hibernate offers and still can not do better than 35 seconds.
1st optimisation : I started with IDENTITY sequence generator which ... | After trying all possible solutions I finally found a solution to insert 100,000 rows under 5 seconds!
Things I tried:
1) Replaced hibernate/database's AUTOINCREMENT/GENERATED id's by self generated ID's using AtomicInteger
2) Enabling batch_inserts with batch_size=50
3) Flushing cache after every 'batch_size' numb... |
7190536 | Dummy command in windows cmd | 24 | 2011-08-25 12:41:57 | <p>In linux we have a makefile:</p>
<pre><code>$(foreach A,a b,echo $(A) &&) true
</code></pre>
<p>It works and echos</p>
<pre><code>a
b
</code></pre>
<p>Now we want to port it to Windows. The shortest command I've found for Windows that does nothing:</p>
<pre><code>if 0==1 0
</code></pre>
<p>So the makef... | 25,280 | 452,139 | 2022-01-15 17:26:16 | 7,191,952 | 29 | 2011-08-25 14:17:03 | 902,497 | 2011-08-25 14:17:03 | https://stackoverflow.com/q/7190536 | https://stackoverflow.com/a/7191952 | <p>The <code>rem</code> command does nothing.</p>
| <p>The <code>rem</code> command does nothing.</p> | 64, 2631, 7002, 39458 | batch-file, cmd, no-op, windows | <h1>Dummy command in windows cmd</h1>
<p>In linux we have a makefile:</p>
<pre><code>$(foreach A,a b,echo $(A) &&) true
</code></pre>
<p>It works and echos</p>
<pre><code>a
b
</code></pre>
<p>Now we want to port it to Windows. The shortest command I've found for Windows that does nothing:</p>
<pre><code>if... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,609 | cmd | # Dummy command in windows cmd
In linux we have a makefile:
```
$(foreach A,a b,echo $(A) &&) true
```
It works and echos
```
a
b
```
Now we want to port it to Windows. The shortest command I've found for Windows that does nothing:
```
if 0==1 0
```
So the makefile example will look like
```
$(foreach A,a b,ech... | The `rem` command does nothing. |
10685893 | Run .exe file in Java from file location | 23 | 2012-05-21 13:10:21 | <p>I have to open a .exe file from my Java program. So I tried following code First. </p>
<pre><code>Process process = runtime.exec("c:\\program files\\test\\test.exe");
</code></pre>
<p>But I was getting some error. Then I found out that the exe has to be launched from that location that is c://program files/test/ o... | 139,046 | 763,747 | 2019-12-03 19:41:38 | 10,686,041 | 29 | 2012-05-21 13:18:50 | 1,055,796 | 2012-05-21 14:57:21 | https://stackoverflow.com/q/10685893 | https://stackoverflow.com/a/10686041 | <p>You don't need a console. You can execute a process using a working directory:</p>
<p>exec(String command, String[] envp, File dir) </p>
<p>Executes the specified string command in a separate process
with the specified environment and working directory.</p>
<ul>
<li>command is the location of the .exe </li>
<li>... | <p>You don't need a console. You can execute a process using a working directory:</p> <p>exec(String command, String[] envp, File dir) </p> <p>Executes the specified string command in a separate process with the specified environment and working directory.</p> <ul> <li>command is the location of the .exe </li> <li>... | 17, 64, 3727, 7002, 31594 | batch-file, bufferedreader, exe, java, windows | <h1>Run .exe file in Java from file location</h1>
<p>I have to open a .exe file from my Java program. So I tried following code First. </p>
<pre><code>Process process = runtime.exec("c:\\program files\\test\\test.exe");
</code></pre>
<p>But I was getting some error. Then I found out that the exe has to be launched fr... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,610 | cmd | # Run .exe file in Java from file location
I have to open a .exe file from my Java program. So I tried following code First.
```
Process process = runtime.exec("c:\\program files\\test\\test.exe");
```
But I was getting some error. Then I found out that the exe has to be launched from that location that is c://progr... | You don't need a console. You can execute a process using a working directory:
exec(String command, String[] envp, File dir)
Executes the specified string command in a separate process
with the specified environment and working directory.
- command is the location of the .exe
- envp can be null
- dir, is the directo... |
28566341 | run spring batch job from the controller | 22 | 2015-02-17 16:36:56 | <p>I am trying to run my batch job from a controller. It will be either fired up by a cron job or by accessing a specific link.
I am using Spring Boot, no XML just annotations.</p>
<p>In my current setting I have a service that contains the following beans:</p>
<pre><code>@EnableBatchProcessing
@PersistenceContext
p... | 42,911 | 2,083,691 | 2020-03-02 06:25:23 | 28,567,036 | 29 | 2015-02-17 17:09:49 | 1,384,297 | 2015-02-17 17:09:49 | https://stackoverflow.com/q/28566341 | https://stackoverflow.com/a/28567036 | <p>You can launch a batch job programmatically using <code>JobLauncher</code> which can be injected into your controller. See the <a href="http://docs.spring.io/spring-batch/reference/htmlsingle/#runningJobsFromWebContainer">Spring Batch documentation</a> for more details, including this example controller:</p>
<pre><... | <p>You can launch a batch job programmatically using <code>JobLauncher</code> which can be injected into your controller. See the <a href="http://docs.spring.io/spring-batch/reference/htmlsingle/#runningJobsFromWebContainer">Spring Batch documentation</a> for more details, including this example controller:</p> <pre><... | 1211, 7027, 41895, 95875 | spring, spring-batch, spring-boot, spring-mvc | <h1>run spring batch job from the controller</h1>
<p>I am trying to run my batch job from a controller. It will be either fired up by a cron job or by accessing a specific link.
I am using Spring Boot, no XML just annotations.</p>
<p>In my current setting I have a service that contains the following beans:</p>
<pre>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,611 | cmd | # run spring batch job from the controller
I am trying to run my batch job from a controller. It will be either fired up by a cron job or by accessing a specific link.
I am using Spring Boot, no XML just annotations.
In my current setting I have a service that contains the following beans:
```
@EnableBatchProcessing... | You can launch a batch job programmatically using `JobLauncher` which can be injected into your controller. See the [Spring Batch documentation](http://docs.spring.io/spring-batch/reference/htmlsingle/#runningJobsFromWebContainer) for more details, including this example controller:
```
@Controller
public class JobLau... |
25324354 | Windows Batch files: what is variable expansion, and what does EnableDelayedExpansion mean? | 22 | 2014-08-15 09:43:32 | <p>What is meant by "variable expansion"? Does it mean simply "variable definition", or something else?</p>
<p>What happens when I say <code>setLocal EnableDelayedExpansion</code>? Google wasn't clear.</p>
| 37,490 | 3,284,878 | 2020-02-01 16:46:09 | 25,328,044 | 29 | 2014-08-15 14:14:47 | 778,560 | 2014-08-15 14:30:16 | https://stackoverflow.com/q/25324354 | https://stackoverflow.com/a/25328044 | <ul>
<li>Variable <em>expansion</em> means replace a variable enclosed in <code>%</code> or <code>!</code> by its value.</li>
<li>The <code>%normal%</code> expansion happen <strong>just once</strong>, <em>before</em> a line is executed. This means that a <code>%variable%</code> expansion have <em>the same value</em> no... | <ul> <li>Variable <em>expansion</em> means replace a variable enclosed in <code>%</code> or <code>!</code> by its value.</li> <li>The <code>%normal%</code> expansion happen <strong>just once</strong>, <em>before</em> a line is executed. This means that a <code>%variable%</code> expansion have <em>the same value</em> no... | 276, 7002 | batch-file, variables | <h1>Windows Batch files: what is variable expansion, and what does EnableDelayedExpansion mean?</h1>
<p>What is meant by "variable expansion"? Does it mean simply "variable definition", or something else?</p>
<p>What happens when I say <code>setLocal EnableDelayedExpansion</code>? Google wasn't clear.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,612 | cmd | # Windows Batch files: what is variable expansion, and what does EnableDelayedExpansion mean?
What is meant by "variable expansion"? Does it mean simply "variable definition", or something else?
What happens when I say `setLocal EnableDelayedExpansion`? Google wasn't clear. | - Variable *expansion* means replace a variable enclosed in `%` or `!` by its value.
- The `%normal%` expansion happen **just once**, *before* a line is executed. This means that a `%variable%` expansion have *the same value* no matters if the line is executed several times (like in a `for` command).
- The `!delayed!` ... |
32370254 | What is the difference between MD and MKDIR batch command? | 20 | 2015-09-03 08:08:40 | <p>Both command creates folders. I <a href="http://www.computerhope.com/mdhlp.htm" rel="noreferrer">read</a> that MKDIR can create even subfolders. </p>
<ul>
<li>Is that only difference?</li>
<li>Why there are two commands doing the same?</li>
<li>Which one should I use?</li>
</ul>
| 36,515 | 518,530 | 2022-12-28 16:02:21 | 32,370,298 | 29 | 2015-09-03 08:10:44 | 388,389 | 2015-09-03 08:10:44 | https://stackoverflow.com/q/32370254 | https://stackoverflow.com/a/32370298 | <p>Just aliases of the same command.Here are the help messages:</p>
<pre><code>C:\>md /?
Creates a directory.
MKDIR [drive:]path
MD [drive:]path
</code></pre>
<p>and </p>
<pre><code>C:\>mkdir /?
Creates a directory.
MKDIR [drive:]path
MD [drive:]path
If Command Extensions are enabled MKDIR changes as follow... | <p>Just aliases of the same command.Here are the help messages:</p> <pre><code>C:\>md /? Creates a directory. MKDIR [drive:]path MD [drive:]path </code></pre> <p>and </p> <pre><code>C:\>mkdir /? Creates a directory. MKDIR [drive:]path MD [drive:]path If Command Extensions are enabled MKDIR changes as follow... | 64, 2631, 5370, 7002, 24423 | batch-file, cmd, dos, mkdir, windows | <h1>What is the difference between MD and MKDIR batch command?</h1>
<p>Both command creates folders. I <a href="http://www.computerhope.com/mdhlp.htm" rel="noreferrer">read</a> that MKDIR can create even subfolders. </p>
<ul>
<li>Is that only difference?</li>
<li>Why there are two commands doing the same?</li>
<li>Whi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,613 | cmd | # What is the difference between MD and MKDIR batch command?
Both command creates folders. I [read](http://www.computerhope.com/mdhlp.htm) that MKDIR can create even subfolders.
- Is that only difference?
- Why there are two commands doing the same?
- Which one should I use? | Just aliases of the same command.Here are the help messages:
```
C:\>md /?
Creates a directory.
MKDIR [drive:]path
MD [drive:]path
```
and
```
C:\>mkdir /?
Creates a directory.
MKDIR [drive:]path
MD [drive:]path
If Command Extensions are enabled MKDIR changes as follows:
MKDIR creates any intermediate directorie... |
18896154 | Calling Gradle from .bat causes batch execution to stop | 19 | 2013-09-19 13:35:54 | <p>I'm automating the publication of my Android app and I'm using <strong>Gradle</strong>, great utility!</p>
<p>Just a problem, consider this .bat file (under Windows 7):</p>
<pre><code>:: assemble the project
gradle assemble -Pprofile_name=%profile_name% -p%destination_dir%
::copy apk to repository
copy "D:\compil... | 5,464 | 1,331,488 | 2017-10-06 08:15:16 | 23,905,414 | 29 | 2014-05-28 07:34:21 | 3,682,581 | 2014-05-28 07:34:21 | https://stackoverflow.com/q/18896154 | https://stackoverflow.com/a/23905414 | <p>I ran into this very same problem, but for a webapp. Gradle isn't necessarily the issue, but how you are invoking it. As explained in this post,</p>
<p><a href="https://stackoverflow.com/questions/6573062/execute-more-than-one-maven-command-in-bat-file">How to execute more than one maven command in bat file?</a></p... | <p>I ran into this very same problem, but for a webapp. Gradle isn't necessarily the issue, but how you are invoking it. As explained in this post,</p> <p><a href="https://stackoverflow.com/questions/6573062/execute-more-than-one-maven-command-in-bat-file">How to execute more than one maven command in bat file?</a></p... | 64, 1231, 1386, 7002, 32307 | android, batch-file, command-line, gradle, windows | <h1>Calling Gradle from .bat causes batch execution to stop</h1>
<p>I'm automating the publication of my Android app and I'm using <strong>Gradle</strong>, great utility!</p>
<p>Just a problem, consider this .bat file (under Windows 7):</p>
<pre><code>:: assemble the project
gradle assemble -Pprofile_name=%profile_na... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,614 | cmd | # Calling Gradle from .bat causes batch execution to stop
I'm automating the publication of my Android app and I'm using **Gradle**, great utility!
Just a problem, consider this .bat file (under Windows 7):
```
:: assemble the project
gradle assemble -Pprofile_name=%profile_name% -p%destination_dir%
::copy apk to r... | I ran into this very same problem, but for a webapp. Gradle isn't necessarily the issue, but how you are invoking it. As explained in this post,
[How to execute more than one maven command in bat file?](https://stackoverflow.com/questions/6573062/execute-more-than-one-maven-command-in-bat-file)
because gradle is a ba... |
38593856 | Error hresult :80004001 , message : Command execution failed. Not implemented | 17 | 2016-07-26 15:19:20 | <p>I ran the command "<code>%windir%\system32\inetsrv\appcmd list requests /elapsed:1000</code>" in the server and encountered the following error:</p>
<blockquote>
<p>Error < hresult :80004001 , message : Command execution failed. Not
implemented</p>
</blockquote>
| 10,302 | 6,640,585 | 2016-07-26 19:45:26 | 38,594,189 | 29 | 2016-07-26 15:34:04 | 4,681,341 | 2016-07-26 15:39:04 | https://stackoverflow.com/q/38593856 | https://stackoverflow.com/a/38594189 | <p>Looks like there are certain IIS features not included when it was setup.</p>
<pre><code>Right Click on My Computer and Select Manage.This will open Server Manager
Select Manage and Choose Add Roles/Features
Select Installation Type Role-Based/ feature based installation,Click next
Select server,Click next
Select ... | <p>Looks like there are certain IIS features not included when it was setup.</p> <pre><code>Right Click on My Computer and Select Manage.This will open Server Manager Select Manage and Choose Add Roles/Features Select Installation Type Role-Based/ feature based installation,Click next Select server,Click next Select ... | 215, 2631 | cmd, iis | <h1>Error hresult :80004001 , message : Command execution failed. Not implemented</h1>
<p>I ran the command "<code>%windir%\system32\inetsrv\appcmd list requests /elapsed:1000</code>" in the server and encountered the following error:</p>
<blockquote>
<p>Error < hresult :80004001 , message : Command execution fai... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,616 | cmd | # Error hresult :80004001 , message : Command execution failed. Not implemented
I ran the command "`%windir%\system32\inetsrv\appcmd list requests /elapsed:1000`" in the server and encountered the following error:
> Error < hresult :80004001 , message : Command execution failed. Not
> implemented | Looks like there are certain IIS features not included when it was setup.
```
Right Click on My Computer and Select Manage.This will open Server Manager
Select Manage and Choose Add Roles/Features
Select Installation Type Role-Based/ feature based installation,Click next
Select server,Click next
Select server roles a... |
18652001 | Send mail via CMD console | 17 | 2013-09-06 07:13:57 | <p>Hi i want to send mail via microsoft cmd console. I tried many way, but i didnt succeed. </p>
<p>i tried this article <a href="http://jpsoft.com/help/index.htm?sendmail.htm" rel="noreferrer">http://jpsoft.com/help/index.htm?sendmail.htm</a> </p>
<pre><code>sendmail "bob@bob.com bcc:joe@joe.com" Test Hello!
</code>... | 208,335 | 1,479,273 | 2018-12-05 02:19:57 | 18,653,000 | 29 | 2013-09-06 08:13:59 | 1,271,142 | 2018-12-05 02:19:57 | https://stackoverflow.com/q/18652001 | https://stackoverflow.com/a/18653000 | <p><em>Scenario:</em>
Your domain: <code>mydomain.com</code>
Domain you wish to send to: <code>theirdomain.com</code></p>
<p><strong>1. Determine the mail server you're sending to.</strong>
Open a CMD prompt
Type </p>
<pre><code>NSLOOKUP
set q=mx
theirdomain.com
</code></pre>
<p><em>Response:</em> </p>
... | <p><em>Scenario:</em> Your domain: <code>mydomain.com</code> Domain you wish to send to: <code>theirdomain.com</code></p> <p><strong>1. Determine the mail server you're sending to.</strong> Open a CMD prompt Type </p> <pre><code>NSLOOKUP set q=mx theirdomain.com </code></pre> <p><em>Response:</em> </p> ... | 146, 488, 2631, 2900, 3836 | cmd, console, email, sendmail, smtp | <h1>Send mail via CMD console</h1>
<p>Hi i want to send mail via microsoft cmd console. I tried many way, but i didnt succeed. </p>
<p>i tried this article <a href="http://jpsoft.com/help/index.htm?sendmail.htm" rel="noreferrer">http://jpsoft.com/help/index.htm?sendmail.htm</a> </p>
<pre><code>sendmail "bob@bob.com b... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,617 | cmd | # Send mail via CMD console
Hi i want to send mail via microsoft cmd console. I tried many way, but i didnt succeed.
i tried this article <http://jpsoft.com/help/index.htm?sendmail.htm>
```
sendmail "bob@bob.com bcc:joe@joe.com" Test Hello!
```
**the error is :**
```
'sendmail' is not recognized as an internal or ... | *Scenario:*
Your domain: `mydomain.com`
Domain you wish to send to: `theirdomain.com`
**1. Determine the mail server you're sending to.**
Open a CMD prompt
Type
```
NSLOOKUP
set q=mx
theirdomain.com
```
*Response:*
```
Non-authoritative answer:
theirdomain.com MX preference = 50, mail exchanger = mail.theirdom... |
36027461 | Opening/Closing application via .bat file [Windows] | 16 | 2016-03-16 05:30:28 | <p>Good Day, I have a .bat file that run a specific application then after 5 seconds it will close/kill it.</p>
<p>I having right now due to it successfully open the application thought when the app opens it will not execute the remaining commands unless I manually close the app.</p>
<p>Here is my code:</p>
<pre><co... | 127,703 | 5,395,955 | 2025-05-08 06:33:53 | 36,029,172 | 29 | 2016-03-16 07:25:33 | 3,080,770 | 2016-03-16 08:43:11 | https://stackoverflow.com/q/36027461 | https://stackoverflow.com/a/36029172 | <p>You can use <a href="http://ss64.com/nt/start.html" rel="noreferrer"><strong><em>Start /b</em></strong></a> command.</p>
<pre><code>@echo off
cd "C:\Program Files (x86)\Aspera\Point-to-Point\bin\"
Start "" /b asperascp.exe
timeout /T 5 /nobreak >nul
taskkill /IM asperascp.exe /F
</code></pre>
| <p>You can use <a href="http://ss64.com/nt/start.html" rel="noreferrer"><strong><em>Start /b</em></strong></a> command.</p> <pre><code>@echo off cd "C:\Program Files (x86)\Aspera\Point-to-Point\bin\" Start "" /b asperascp.exe timeout /T 5 /nobreak >nul taskkill /IM asperascp.exe /F </code></pre> | 64, 2631, 5779, 7002 | batch-file, cmd, kill, windows | <h1>Opening/Closing application via .bat file [Windows]</h1>
<p>Good Day, I have a .bat file that run a specific application then after 5 seconds it will close/kill it.</p>
<p>I having right now due to it successfully open the application thought when the app opens it will not execute the remaining commands unless I m... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,618 | cmd | # Opening/Closing application via .bat file [Windows]
Good Day, I have a .bat file that run a specific application then after 5 seconds it will close/kill it.
I having right now due to it successfully open the application thought when the app opens it will not execute the remaining commands unless I manually close th... | You can use [***Start /b***](http://ss64.com/nt/start.html) command.
```
@echo off
cd "C:\Program Files (x86)\Aspera\Point-to-Point\bin\"
Start "" /b asperascp.exe
timeout /T 5 /nobreak >nul
taskkill /IM asperascp.exe /F
``` |
6313960 | an arrow → character getting appeded to files in a .bat script | 16 | 2011-06-11 04:01:13 | <p>The following script gets all files with .new_tmp extension and copies them to a file with the same name but without the .new_tmp extension. In addition a comment is placed at the top of the file and the .new_tmp file is deleted.</p>
<pre><code>echo ^<?php /* > start.tmp
echo */ ?^> > end.tmp
for /R "... | 15,213 | 248,521 | 2013-08-07 11:37:43 | 6,315,036 | 29 | 2011-06-11 08:53:53 | 30,447 | 2011-06-11 09:04:21 | https://stackoverflow.com/q/6313960 | https://stackoverflow.com/a/6315036 | <p>The arrow is a CTRL-Z ascii char that is appended by the <code>COPY</code> command when used to concatenate files with the <code>+</code> option.</p>
<p>To prevent <code>COPY</code> to append the CTRL-Z character, use <code>COPY /B</code> for a binary copy.</p>
<p>So, your command would be</p>
<pre><code>COPY /B ... | <p>The arrow is a CTRL-Z ascii char that is appended by the <code>COPY</code> command when used to concatenate files with the <code>+</code> option.</p> <p>To prevent <code>COPY</code> to append the CTRL-Z character, use <code>COPY /B</code> for a binary copy.</p> <p>So, your command would be</p> <pre><code>COPY /B ... | 7002 | batch-file | <h1>an arrow → character getting appeded to files in a .bat script</h1>
<p>The following script gets all files with .new_tmp extension and copies them to a file with the same name but without the .new_tmp extension. In addition a comment is placed at the top of the file and the .new_tmp file is deleted.</p>
<pre><co... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,619 | cmd | # an arrow → character getting appeded to files in a .bat script
The following script gets all files with .new_tmp extension and copies them to a file with the same name but without the .new_tmp extension. In addition a comment is placed at the top of the file and the .new_tmp file is deleted.
```
echo ^<?php /* > st... | The arrow is a CTRL-Z ascii char that is appended by the `COPY` command when used to concatenate files with the `+` option.
To prevent `COPY` to append the CTRL-Z character, use `COPY /B` for a binary copy.
So, your command would be
```
COPY /B start.tmp+license.txt+end.tmp+%%I worker.tmp
``` |
4224995 | How to rename n files with ANT? (Batch Job) | 16 | 2010-11-19 12:33:32 | <p>How can I rename 1..n file with ANT? I would like to rename any files with <code>xxxx.default.properties</code> to <code>xxxx.local.properties</code>.</p>
<p>Thank you.</p>
| 15,761 | 42,659 | 2018-03-19 07:23:08 | 4,225,057 | 29 | 2010-11-19 12:40:33 | 20,654 | 2010-11-19 12:40:33 | https://stackoverflow.com/q/4224995 | https://stackoverflow.com/a/4225057 | <p>Using the <a href="http://ant.apache.org/manual/Tasks/move.html" rel="noreferrer">move</a> task you could do something like this:</p>
<pre><code> <move todir="my/src/dir" includeemptydirs="false">
<fileset dir="my/src/dir"/>
<mapper type="glob" from="*.default.properties" to="*.local.propert... | <p>Using the <a href="http://ant.apache.org/manual/Tasks/move.html" rel="noreferrer">move</a> task you could do something like this:</p> <pre><code> <move todir="my/src/dir" includeemptydirs="false"> <fileset dir="my/src/dir"/> <mapper type="glob" from="*.default.properties" to="*.local.propert... | 17, 142, 30645 | ant, batch-processing, java | <h1>How to rename n files with ANT? (Batch Job)</h1>
<p>How can I rename 1..n file with ANT? I would like to rename any files with <code>xxxx.default.properties</code> to <code>xxxx.local.properties</code>.</p>
<p>Thank you.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,620 | cmd | # How to rename n files with ANT? (Batch Job)
How can I rename 1..n file with ANT? I would like to rename any files with `xxxx.default.properties` to `xxxx.local.properties`.
Thank you. | Using the [move](http://ant.apache.org/manual/Tasks/move.html) task you could do something like this:
```
<move todir="my/src/dir" includeemptydirs="false">
<fileset dir="my/src/dir"/>
<mapper type="glob" from="*.default.properties" to="*.local.properties"/>
</move>
```
Give it a try and let us know. |
42725408 | how do I use angular cli on a Windows Server in a Jenkins build batch command | 15 | 2017-03-10 18:30:41 | <p>before installing Jenkins I ran this:
<strong>npm install -g @angular/cli</strong></p>
<p>but I also have this in devDependencies in the package.json for the project: </p>
<p><strong>"@angular/cli": "1.0.0-beta.32.3"</strong>,</p>
<hr>
<p>when running a Jenkins build, I get this message in the log:</p>
<p><em>'... | 15,042 | 372,225 | 2018-04-10 19:05:49 | 42,726,279 | 29 | 2017-03-10 19:27:34 | 1,413,538 | 2017-03-10 19:27:34 | https://stackoverflow.com/q/42725408 | https://stackoverflow.com/a/42726279 | <p>Do not install the CLI globally.</p>
<p>Run the <code>npm install</code> for the repo and any time you need to run an <code>ng</code> command use this:</p>
<pre><code>node_modules/.bin/ng [command goes here]
</code></pre>
<p>This will save on install time and ensure there are no differences between your local and... | <p>Do not install the CLI globally.</p> <p>Run the <code>npm install</code> for the repo and any time you need to run an <code>ng</code> command use this:</p> <pre><code>node_modules/.bin/ng [command goes here] </code></pre> <p>This will save on install time and ensure there are no differences between your local and... | 64, 6268, 7002, 64999, 117722 | angular-cli, batch-file, jenkins, path, windows | <h1>how do I use angular cli on a Windows Server in a Jenkins build batch command</h1>
<p>before installing Jenkins I ran this:
<strong>npm install -g @angular/cli</strong></p>
<p>but I also have this in devDependencies in the package.json for the project: </p>
<p><strong>"@angular/cli": "1.0.0-beta.32.3"</strong>,</... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,621 | cmd | # how do I use angular cli on a Windows Server in a Jenkins build batch command
before installing Jenkins I ran this:
**npm install -g @angular/cli**
but I also have this in devDependencies in the package.json for the project:
**"@angular/cli": "1.0.0-beta.32.3"**,
---
when running a Jenkins build, I get this mess... | Do not install the CLI globally.
Run the `npm install` for the repo and any time you need to run an `ng` command use this:
```
node_modules/.bin/ng [command goes here]
```
This will save on install time and ensure there are no differences between your local and global versions.
*Additional commentary: Update your a... |
32465142 | Spring Batch accessing job parameter inside step | 15 | 2015-09-08 18:50:48 | <p>I have a following Spring Batch Job config:</p>
<pre><code>@Configuration
@EnableBatchProcessing
public class JobConfig {
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Bean
public Job job() {
return jobBuilderFac... | 31,445 | 1,219,755 | 2015-09-26 17:02:13 | 32,465,276 | 29 | 2015-09-08 18:57:19 | 1,919,879 | 2015-09-08 19:03:50 | https://stackoverflow.com/q/32465142 | https://stackoverflow.com/a/32465276 | <p><code>Tasklet.execute()</code> method takes parameter <code>ChunkContext</code>, where Spring Batch injects all the metadata. So you just need to dig into job parameters via these metadata structures:</p>
<pre><code>chunkContext.getStepContext().getStepExecution()
.getJobParameters().getString("ccReportId");
... | <p><code>Tasklet.execute()</code> method takes parameter <code>ChunkContext</code>, where Spring Batch injects all the metadata. So you just need to dig into job parameters via these metadata structures:</p> <pre><code>chunkContext.getStepContext().getStepExecution() .getJobParameters().getString("ccReportId"); ... | 17, 1211, 41895 | java, spring, spring-batch | <h1>Spring Batch accessing job parameter inside step</h1>
<p>I have a following Spring Batch Job config:</p>
<pre><code>@Configuration
@EnableBatchProcessing
public class JobConfig {
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,622 | cmd | # Spring Batch accessing job parameter inside step
I have a following Spring Batch Job config:
```
@Configuration
@EnableBatchProcessing
public class JobConfig {
@Autowired
private JobBuilderFactory jobBuilderFactory;
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Bean
public Jo... | `Tasklet.execute()` method takes parameter `ChunkContext`, where Spring Batch injects all the metadata. So you just need to dig into job parameters via these metadata structures:
```
chunkContext.getStepContext().getStepExecution()
.getJobParameters().getString("ccReportId");
```
or other option is to access jo... |
6474738 | Batch File: FOR /F doesn't work if path has spaces | 15 | 2011-06-24 23:29:06 | <p>This is the problem I'm having:</p>
<pre><code>@ECHO OFF
REM If this batch file is run in the same directory as "command.exe" then the
REM following line will work.
FOR /F "usebackq" %%A IN (`command.exe "C:\File Being Passed as a Parameter.txt"`) DO ECHO %%A
REM The following line does not work no matter where t... | 15,471 | 814,691 | 2024-12-29 10:53:44 | 6,478,227 | 29 | 2011-06-25 14:03:29 | 297,408 | 2011-06-25 14:03:29 | https://stackoverflow.com/q/6474738 | https://stackoverflow.com/a/6478227 | <p>Add <code>CALL</code> before the program name:</p>
<pre><code>FOR /F "usebackq" %%A IN (`<b><i>CALL</i></b> "C:\Folder With Spaces\command.exe" "C:\File Being Passed as a Parameter.txt"`) DO ECHO %%A
</code></pre>
| <p>Add <code>CALL</code> before the program name:</p> <pre><code>FOR /F "usebackq" %%A IN (`<b><i>CALL</i></b> "C:\Folder With Spaces\command.exe" "C:\File Being Passed as a Parameter.txt"`) DO ECHO %%A </code></pre> | 7002 | batch-file | <h1>Batch File: FOR /F doesn't work if path has spaces</h1>
<p>This is the problem I'm having:</p>
<pre><code>@ECHO OFF
REM If this batch file is run in the same directory as "command.exe" then the
REM following line will work.
FOR /F "usebackq" %%A IN (`command.exe "C:\File Being Passed as a Parameter.txt"`) DO ECHO... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,623 | cmd | # Batch File: FOR /F doesn't work if path has spaces
This is the problem I'm having:
```
@ECHO OFF
REM If this batch file is run in the same directory as "command.exe" then the
REM following line will work.
FOR /F "usebackq" %%A IN (`command.exe "C:\File Being Passed as a Parameter.txt"`) DO ECHO %%A
REM The follow... | Add `CALL` before the program name:
```
FOR /F "usebackq" %%A IN (`CALL "C:\Folder With Spaces\command.exe" "C:\File Being Passed as a Parameter.txt"`) DO ECHO %%A
``` |
877232 | Batch file fails to set environment variable within conditional statement | 15 | 2009-05-18 11:21:25 | <p>Why does the following Windows Batch File output <code>Foo</code> followedby <code>Bar</code>, rather than <code>Baz</code>?</p>
<pre><code>@echo off
setlocal
set _=Foo
echo %_%
set _=Bar
if 1==1 (
set _=Baz
echo %_%
)
</code></pre>
<p>The output on my system (Microsoft Windows XP [Version 5.1.2600]) is:<... | 9,977 | 5,975 | 2012-03-01 23:47:35 | 877,719 | 29 | 2009-05-18 13:21:40 | 14,860 | 2012-03-01 23:47:35 | https://stackoverflow.com/q/877232 | https://stackoverflow.com/a/877719 | <p>What's happening is that variable substitution is done when a line is read. What you're failing to take into account is the fact that:</p>
<pre><code>if 1==1 (
set _=Baz
echo %_%
)
</code></pre>
<p>is <em>one</em> "line", despite what you may think. The expansion of <code>"%_%"</code> is done <em>before</e... | <p>What's happening is that variable substitution is done when a line is read. What you're failing to take into account is the fact that:</p> <pre><code>if 1==1 ( set _=Baz echo %_% ) </code></pre> <p>is <em>one</em> "line", despite what you may think. The expansion of <code>"%_%"</code> is done <em>before</e... | 7002 | batch-file | <h1>Batch file fails to set environment variable within conditional statement</h1>
<p>Why does the following Windows Batch File output <code>Foo</code> followedby <code>Bar</code>, rather than <code>Baz</code>?</p>
<pre><code>@echo off
setlocal
set _=Foo
echo %_%
set _=Bar
if 1==1 (
set _=Baz
echo %_%
)
</cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,624 | cmd | # Batch file fails to set environment variable within conditional statement
Why does the following Windows Batch File output `Foo` followedby `Bar`, rather than `Baz`?
```
@echo off
setlocal
set _=Foo
echo %_%
set _=Bar
if 1==1 (
set _=Baz
echo %_%
)
```
The output on my system (Microsoft Windows XP [Versio... | What's happening is that variable substitution is done when a line is read. What you're failing to take into account is the fact that:
```
if 1==1 (
set _=Baz
echo %_%
)
```
is *one* "line", despite what you may think. The expansion of `"%_%"` is done *before* the `set` statement.
What you need is delayed ex... |
62227905 | Using Curl in the CMD To send a Discord webhook | 14 | 2020-06-06 05:50:13 | <p>I want to send a Webhook Using The CMD Command line Curl
However the command i made:</p>
<pre><code>curl -X POST --data '{"content": "Posted Via Command line"}' --header "Content-Type:application/json" discord-webhook-link
</code></pre>
<p>Returns This Message</p>
<blockquote>
<p>curl: ... | 34,195 | 13,692,121 | 2023-06-18 04:35:28 | 62,301,184 | 29 | 2020-06-10 10:21:06 | 13,719,961 | 2020-06-10 10:21:06 | https://stackoverflow.com/q/62227905 | https://stackoverflow.com/a/62301184 | <p>the following syntax is working for me, maybe give it a try.</p>
<pre><code>curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"Posted Via Command line\"}" discord-webhook-link
</code></pre>
| <p>the following syntax is working for me, maybe give it a try.</p> <pre><code>curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"Posted Via Command line\"}" discord-webhook-link </code></pre> | 1554, 2631, 122697 | cmd, curl, discord | <h1>Using Curl in the CMD To send a Discord webhook</h1>
<p>I want to send a Webhook Using The CMD Command line Curl
However the command i made:</p>
<pre><code>curl -X POST --data '{"content": "Posted Via Command line"}' --header "Content-Type:application/json" discord-webhook-link
</code>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,625 | cmd | # Using Curl in the CMD To send a Discord webhook
I want to send a Webhook Using The CMD Command line Curl
However the command i made:
```
curl -X POST --data '{"content": "Posted Via Command line"}' --header "Content-Type:application/json" discord-webhook-link
```
Returns This Message
> curl: (3) [globbing] unmatc... | the following syntax is working for me, maybe give it a try.
```
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"Posted Via Command line\"}" discord-webhook-link
``` |
39129178 | CMD (command prompt) can't go to the desktop | 14 | 2016-08-24 17:02:41 | <p>when I open the commend prompt the default line is this</p>
<pre><code>C:\Windows\system32>
</code></pre>
<p>and I'm using SASS to convert a .scss file located located on my desktop.</p>
<p>I know the default line should be saying something like this C:\Users\the name of my machine</p>
<p>I type c:\Users\MyName\D... | 202,188 | 6,478,503 | 2022-08-29 17:03:49 | 39,129,221 | 29 | 2016-08-24 17:05:39 | 2,666,293 | 2022-08-29 17:03:49 | https://stackoverflow.com/q/39129178 | https://stackoverflow.com/a/39129221 | <p>You need to use the change directory command 'cd' to change directory</p>
<p><code>cd C:\Users\MyName\Desktop</code></p>
<p>you can use <code>cd /d</code> to change the drive as well.</p>
<p>link for additional resources
<a href="http://ss64.com/nt/cd.html" rel="noreferrer">http://ss64.com/nt/cd.html</a></p>
<p>-- E... | <p>You need to use the change directory command 'cd' to change directory</p> <p><code>cd C:\Users\MyName\Desktop</code></p> <p>you can use <code>cd /d</code> to change the drive as well.</p> <p>link for additional resources <a href="http://ss64.com/nt/cd.html" rel="noreferrer">http://ss64.com/nt/cd.html</a></p> <p>-- E... | 64, 2631 | cmd, windows | <h1>CMD (command prompt) can't go to the desktop</h1>
<p>when I open the commend prompt the default line is this</p>
<pre><code>C:\Windows\system32>
</code></pre>
<p>and I'm using SASS to convert a .scss file located located on my desktop.</p>
<p>I know the default line should be saying something like this C:\Users\... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 12,626 | cmd | # CMD (command prompt) can't go to the desktop
when I open the commend prompt the default line is this
```
C:\Windows\system32>
```
and I'm using SASS to convert a .scss file located located on my desktop.
I know the default line should be saying something like this C:\Users\the name of my machine
I type c:\Users\... | You need to use the change directory command 'cd' to change directory
`cd C:\Users\MyName\Desktop`
you can use `cd /d` to change the drive as well.
link for additional resources
<http://ss64.com/nt/cd.html>
-- Edit --
The above assumes that your desktop is in the normal location. Sometimes (eg. you are using onedr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.