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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
18023575 | C#, How to run a .bat file without a popup console window | 6 | 2013-08-02 18:15:13 | <p>I'm trying to run a <code>.bat</code> file without a popup console window.</p>
<p>I'm using this code:</p>
<pre><code>Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "file.bat";
p.Start();
string output = p.StandardOutput.ReadToEnd... | 9,095 | 2,348,113 | 2013-09-14 02:25:52 | 18,023,674 | 16 | 2013-08-02 18:22:45 | 2,440,124 | 2013-08-02 18:22:45 | https://stackoverflow.com/q/18023575 | https://stackoverflow.com/a/18023674 | <p>just add</p>
<pre><code>p.StartInfo.CreateNoWindow=true;
</code></pre>
<p>Console window popup will not appear</p>
| <p>just add</p> <pre><code>p.StartInfo.CreateNoWindow=true; </code></pre> <p>Console window popup will not appear</p> | 9, 7002 | batch-file, c# | <h1>C#, How to run a .bat file without a popup console window</h1>
<p>I'm trying to run a <code>.bat</code> file without a popup console window.</p>
<p>I'm using this code:</p>
<pre><code>Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName =... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,189 | cmd | # C#, How to run a .bat file without a popup console window
I'm trying to run a `.bat` file without a popup console window.
I'm using this code:
```
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "file.bat";
p.Start();
string output... | just add
```
p.StartInfo.CreateNoWindow=true;
```
Console window popup will not appear |
9271107 | .bat file for renaming multiple folders | 6 | 2012-02-14 02:59:27 | <p>I am trying to write a batch script to rename multiple folders.
I would like to do something like below:
Rename all folders under the "Workspace" folder by appending my name in the end of the folder names</p>
<p>For example, rename:</p>
<pre><code>Workspace/RiskFolder
Workspace/PNLFolder
</code></pre>
<p>to:</p>... | 64,824 | 557,429 | 2017-04-19 20:58:53 | 9,271,435 | 16 | 2012-02-14 03:48:15 | 1,186,610 | 2012-02-14 03:48:15 | https://stackoverflow.com/q/9271107 | https://stackoverflow.com/a/9271435 | <p>You could use for to loop through each directory and rename it like so:</p>
<pre><code>for /D %%f in (C:\path\to\Workspace\*) do rename "%%f" "%%~nxf_myname"
</code></pre>
<p>I tested this on Windows 7, but it should work at least as far back as with Windows XP.</p>
<p>What that does is this: for each directory i... | <p>You could use for to loop through each directory and rename it like so:</p> <pre><code>for /D %%f in (C:\path\to\Workspace\*) do rename "%%f" "%%~nxf_myname" </code></pre> <p>I tested this on Windows 7, but it should work at least as far back as with Windows XP.</p> <p>What that does is this: for each directory i... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>.bat file for renaming multiple folders</h1>
<p>I am trying to write a batch script to rename multiple folders.
I would like to do something like below:
Rename all folders under the "Workspace" folder by appending my name in the end of the folder names</p>
<p>For example, rename:</p>
<pre><code>Workspace/RiskFol... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,191 | cmd | # .bat file for renaming multiple folders
I am trying to write a batch script to rename multiple folders.
I would like to do something like below:
Rename all folders under the "Workspace" folder by appending my name in the end of the folder names
For example, rename:
```
Workspace/RiskFolder
Workspace/PNLFolder
```
... | You could use for to loop through each directory and rename it like so:
```
for /D %%f in (C:\path\to\Workspace\*) do rename "%%f" "%%~nxf_myname"
```
I tested this on Windows 7, but it should work at least as far back as with Windows XP.
What that does is this: for each directory in the path (within parenthesis), a... |
3114146 | In a batch file, combining two strings to create a combined path string | 6 | 2010-06-24 21:48:35 | <p>I need to take two strings and combine them into a single path string inside a batch file similar to the Path.Combine method in .NET. For example, whether the strings are "C:\trunk" and "ProjectName\Project.txt" or "C:\trunk\" and "ProjectName\Project.txt", the combined path will be "C:\trunk\ProjectName\Project.txt... | 32,473 | 21,160 | 2015-10-31 10:35:05 | 3,114,237 | 16 | 2010-06-24 22:04:37 | 73,070 | 2012-09-24 15:28:11 | https://stackoverflow.com/q/3114146 | https://stackoverflow.com/a/3114237 | <p>Environment variables you set in a subprocess cannot be passed to the calling process. A process' environment is a copy of its parent's but not vice versa. However, you can simply output the result in PowerShell and read that output from the batch file:</p>
<pre><code>for /f "delims=" %%x in ('powershell -file foo.... | <p>Environment variables you set in a subprocess cannot be passed to the calling process. A process' environment is a copy of its parent's but not vice versa. However, you can simply output the result in PowerShell and read that output from the batch file:</p> <pre><code>for /f "delims=" %%x in ('powershell -file foo.... | 139, 3626, 5310, 6268, 7002 | batch-file, file, join, path, string | <h1>In a batch file, combining two strings to create a combined path string</h1>
<p>I need to take two strings and combine them into a single path string inside a batch file similar to the Path.Combine method in .NET. For example, whether the strings are "C:\trunk" and "ProjectName\Project.txt" or "C:\trunk\" and "Proj... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,192 | cmd | # In a batch file, combining two strings to create a combined path string
I need to take two strings and combine them into a single path string inside a batch file similar to the Path.Combine method in .NET. For example, whether the strings are "C:\trunk" and "ProjectName\Project.txt" or "C:\trunk\" and "ProjectName\P... | Environment variables you set in a subprocess cannot be passed to the calling process. A process' environment is a copy of its parent's but not vice versa. However, you can simply output the result in PowerShell and read that output from the batch file:
```
for /f "delims=" %%x in ('powershell -file foo.ps1') do set j... |
492967 | Is there a command line command for verifying what version of .NET is installed | 66 | 2009-01-29 19:06:32 | <p>I have set of scripts for doing scripted installs. You can use the scripts on any server 2008 machine. However, I need to check if .NET 3.5 has been installed (before the scripts run) using a dos batch file. Is that possible? </p>
<p>I know I can check if a file in the <code>C:\WINDOWS\Microsoft.NET\Framework\v... | 174,367 | null | 2024-03-09 06:17:35 | 492,996 | 15 | 2009-01-29 19:15:40 | 34,211 | 2009-01-29 19:22:53 | https://stackoverflow.com/q/492967 | https://stackoverflow.com/a/492996 | <p>Unfortunately the best way would be to check for that directory. I am not sure what you mean but "actually installed" as .NET 3.5 uses the same CLR as .NET 3.0 and .NET 2.0 so all new functionality is wrapped up in new assemblies that live in that directory. Basically, if the directory is there then 3.5 is install... | <p>Unfortunately the best way would be to check for that directory. I am not sure what you mean but "actually installed" as .NET 3.5 uses the same CLR as .NET 3.0 and .NET 2.0 so all new functionality is wrapped up in new assemblies that live in that directory. Basically, if the directory is there then 3.5 is install... | 1, 64, 2631, 7002 | .net, batch-file, cmd, windows | <h1>Is there a command line command for verifying what version of .NET is installed</h1>
<p>I have set of scripts for doing scripted installs. You can use the scripts on any server 2008 machine. However, I need to check if .NET 3.5 has been installed (before the scripts run) using a dos batch file. Is that possible?... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,193 | cmd | # Is there a command line command for verifying what version of .NET is installed
I have set of scripts for doing scripted installs. You can use the scripts on any server 2008 machine. However, I need to check if .NET 3.5 has been installed (before the scripts run) using a dos batch file. Is that possible?
I know I c... | Unfortunately the best way would be to check for that directory. I am not sure what you mean but "actually installed" as .NET 3.5 uses the same CLR as .NET 3.0 and .NET 2.0 so all new functionality is wrapped up in new assemblies that live in that directory. Basically, if the directory is there then 3.5 is installed.
... |
25077549 | Spring-Batch without persisting metadata to database? | 65 | 2014-08-01 09:55:19 | <p>I want to create a <code>spring-batch</code> job, but I want to run it without any database persistence. Unfortunately spring-batch requires to write <code>metadata</code> ob the job cycles to a database somehow, thus procing me to provide at least some kind of db with transactionmanager and entitymanager.</p>
<p>I... | 125,255 | 1,194,415 | 2023-04-21 23:23:45 | 43,742,074 | 15 | 2017-05-02 15:42:58 | 1,194,415 | 2017-05-02 15:42:58 | https://stackoverflow.com/q/25077549 | https://stackoverflow.com/a/43742074 | <p>I came back to my own question, as the solution did not work anymore.
As of spring-batch-1.5.3 use as follows:</p>
<pre><code>@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
...
@Bean
public PlatformTransactionManager transactionManager() {
return new ResourcelessTransactionMan... | <p>I came back to my own question, as the solution did not work anymore. As of spring-batch-1.5.3 use as follows:</p> <pre><code>@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) ... @Bean public PlatformTransactionManager transactionManager() { return new ResourcelessTransactionMan... | 17, 1211, 41895 | java, spring, spring-batch | <h1>Spring-Batch without persisting metadata to database?</h1>
<p>I want to create a <code>spring-batch</code> job, but I want to run it without any database persistence. Unfortunately spring-batch requires to write <code>metadata</code> ob the job cycles to a database somehow, thus procing me to provide at least some ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,194 | cmd | # Spring-Batch without persisting metadata to database?
I want to create a `spring-batch` job, but I want to run it without any database persistence. Unfortunately spring-batch requires to write `metadata` ob the job cycles to a database somehow, thus procing me to provide at least some kind of db with transactionmana... | I came back to my own question, as the solution did not work anymore.
As of spring-batch-1.5.3 use as follows:
```
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
...
@Bean
public PlatformTransactionManager transactionManager() {
return new ResourcelessTransactionManager();
}
... |
14013145 | Windows batch file pattern rename | 37 | 2012-12-23 17:42:31 | <p>I have some file in Windows 7 such as:</p>
<pre><code>AAA_a001.jpg
BBB_a002.jpg
CCC_a003.jpg
</code></pre>
<p>and I'm trying to use batch to rename these file to:</p>
<pre><code>a001_AAA.jpg
a002_BBB.jpg
a003_CCC.jpg
</code></pre>
<p>Just to swap the content between <code>_</code> in batch, without knowing in advanc... | 304,557 | 1,638,672 | 2024-12-04 13:07:56 | 14,013,693 | 15 | 2012-12-23 18:49:31 | 1,012,053 | 2017-08-12 17:51:23 | https://stackoverflow.com/q/14013145 | https://stackoverflow.com/a/14013693 | <pre><code>@echo off
pushd "pathToYourFolder" || exit /b
for /f "eol=: delims=" %%F in ('dir /b /a-d *_*.jpg') do (
for /f "tokens=1* eol=_ delims=_" %%A in ("%%~nF") do ren "%%F" "%%~nB_%%A%%~xF"
)
popd
</code></pre>
<p>Note: The name is split at the first occurrence of <code>_</code>. If a file is named "part1_par... | <pre><code>@echo off pushd "pathToYourFolder" || exit /b for /f "eol=: delims=" %%F in ('dir /b /a-d *_*.jpg') do ( for /f "tokens=1* eol=_ delims=_" %%A in ("%%~nF") do ren "%%F" "%%~nB_%%A%%~xF" ) popd </code></pre> <p>Note: The name is split at the first occurrence of <code>_</code>. If a file is named "part1_par... | 64, 4510, 7002 | batch-file, rename, windows | <h1>Windows batch file pattern rename</h1>
<p>I have some file in Windows 7 such as:</p>
<pre><code>AAA_a001.jpg
BBB_a002.jpg
CCC_a003.jpg
</code></pre>
<p>and I'm trying to use batch to rename these file to:</p>
<pre><code>a001_AAA.jpg
a002_BBB.jpg
a003_CCC.jpg
</code></pre>
<p>Just to swap the content between <code>_... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,195 | cmd | # Windows batch file pattern rename
I have some file in Windows 7 such as:
```
AAA_a001.jpg
BBB_a002.jpg
CCC_a003.jpg
```
and I'm trying to use batch to rename these file to:
```
a001_AAA.jpg
a002_BBB.jpg
a003_CCC.jpg
```
Just to swap the content between `_` in batch, without knowing in advance the exact names but... | ```
@echo off
pushd "pathToYourFolder" || exit /b
for /f "eol=: delims=" %%F in ('dir /b /a-d *_*.jpg') do (
for /f "tokens=1* eol=_ delims=_" %%A in ("%%~nF") do ren "%%F" "%%~nB_%%A%%~xF"
)
popd
```
Note: The name is split at the first occurrence of `_`. If a file is named "part1_part2_part3.jpg", then it will be ... |
21557623 | How do I set JobParameters in spring batch with spring-boot | 26 | 2014-02-04 16:15:09 | <p>I followed the guide at <a href="http://spring.io/guides/gs/batch-processing/" rel="noreferrer">http://spring.io/guides/gs/batch-processing/</a> but it describes a job with no configurable parameters. I'm using Maven to build my project.</p>
<p>I'm porting an existing job that I have defined in XML and would like t... | 64,087 | 250,648 | 2023-07-19 11:50:11 | 21,558,715 | 15 | 2014-02-04 17:01:08 | 250,648 | 2014-02-04 17:01:08 | https://stackoverflow.com/q/21557623 | https://stackoverflow.com/a/21558715 | <p>I managed to get this working by simply annotating my bean as follows : </p>
<pre><code>@Bean
@StepScope
public Resource destFile(@Value("#{jobParameters[dest]}") String dest) {
return new FileSystemResource(dest);
}
</code></pre>
| <p>I managed to get this working by simply annotating my bean as follows : </p> <pre><code>@Bean @StepScope public Resource destFile(@Value("#{jobParameters[dest]}") String dest) { return new FileSystemResource(dest); } </code></pre> | 41895, 43592, 95875 | spring-batch, spring-boot, spring-el | <h1>How do I set JobParameters in spring batch with spring-boot</h1>
<p>I followed the guide at <a href="http://spring.io/guides/gs/batch-processing/" rel="noreferrer">http://spring.io/guides/gs/batch-processing/</a> but it describes a job with no configurable parameters. I'm using Maven to build my project.</p>
<p>I'... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,196 | cmd | # How do I set JobParameters in spring batch with spring-boot
I followed the guide at <http://spring.io/guides/gs/batch-processing/> but it describes a job with no configurable parameters. I'm using Maven to build my project.
I'm porting an existing job that I have defined in XML and would like to pass-in the jobPara... | I managed to get this working by simply annotating my bean as follows :
```
@Bean
@StepScope
public Resource destFile(@Value("#{jobParameters[dest]}") String dest) {
return new FileSystemResource(dest);
}
``` |
32435599 | $(SolutionDir) MSBuild property incorrect when running Sandcastle Help File Builder via CMD | 24 | 2015-09-07 09:45:22 | <p>When I run the Sandcastle Help File Builder project file (for example, <code>myproject.shfbproj</code>) using Windows CMD, I get an annoying issue: <code>$(SolutionDir)</code> has the same value as <code>$(ProjectDir)</code>, and this means that project documentation sources won't build correctly, because I'm adding... | 31,424 | 411,632 | 2023-04-04 16:53:14 | 32,437,044 | 15 | 2015-09-07 10:59:50 | 411,632 | 2019-07-21 10:18:54 | https://stackoverflow.com/q/32435599 | https://stackoverflow.com/a/32437044 | <p>While @m0sa has pointed out a very obvious fact (since I'm building the Sandcastle Help File Builder project, there's no actual solution directory), the issue was also happening during a TFS Build when building the solution where the so-called documentation project resides.</p>
<p>For now I've managed to solve the ... | <p>While @m0sa has pointed out a very obvious fact (since I'm building the Sandcastle Help File Builder project, there's no actual solution directory), the issue was also happening during a TFS Build when building the solution where the so-called documentation project resides.</p> <p>For now I've managed to solve the ... | 1, 265, 273, 2631, 15799 | .net, cmd, msbuild, sandcastle, shfb | <h1>$(SolutionDir) MSBuild property incorrect when running Sandcastle Help File Builder via CMD</h1>
<p>When I run the Sandcastle Help File Builder project file (for example, <code>myproject.shfbproj</code>) using Windows CMD, I get an annoying issue: <code>$(SolutionDir)</code> has the same value as <code>$(ProjectDir... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,197 | cmd | # $(SolutionDir) MSBuild property incorrect when running Sandcastle Help File Builder via CMD
When I run the Sandcastle Help File Builder project file (for example, `myproject.shfbproj`) using Windows CMD, I get an annoying issue: `$(SolutionDir)` has the same value as `$(ProjectDir)`, and this means that project docu... | While @m0sa has pointed out a very obvious fact (since I'm building the Sandcastle Help File Builder project, there's no actual solution directory), the issue was also happening during a TFS Build when building the solution where the so-called documentation project resides.
For now I've managed to solve the issue usin... |
16820681 | Suppress FORFILES "no files found" error | 23 | 2013-05-29 17:50:32 | <p>I'm working with a batch file to delete archived documents older than 14 days, and I'm calling the file from an automation process (Lansa Composer) that reads the return code of the script to see if there was a problem. Here's the script:</p>
<pre><code>@echo off
@Echo Deleting files older than 14 days...
cd /d C:... | 45,584 | 1,168,116 | 2019-07-18 10:54:11 | 16,827,049 | 15 | 2013-05-30 02:35:40 | 2,299,431 | 2019-05-10 12:03:12 | https://stackoverflow.com/q/16820681 | https://stackoverflow.com/a/16827049 | <p>This should solve that issue:</p>
<pre><code>@echo off
Echo Deleting files older than 14 days...
cd /d C:\Windows\System32
copy /b forfiles.exe "[file path...]\IDOC_ARCHIVE" >nul
FORFILES /P "[file path...]\IDOC_ARCHIVE" /M *.* /D -14 /C "cmd /c del @file"
</code></pre>
<p>What it does is provide a file older t... | <p>This should solve that issue:</p> <pre><code>@echo off Echo Deleting files older than 14 days... cd /d C:\Windows\System32 copy /b forfiles.exe "[file path...]\IDOC_ARCHIVE" >nul FORFILES /P "[file path...]\IDOC_ARCHIVE" /M *.* /D -14 /C "cmd /c del @file" </code></pre> <p>What it does is provide a file older t... | 7002 | batch-file | <h1>Suppress FORFILES "no files found" error</h1>
<p>I'm working with a batch file to delete archived documents older than 14 days, and I'm calling the file from an automation process (Lansa Composer) that reads the return code of the script to see if there was a problem. Here's the script:</p>
<pre><code>@echo off
@... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,198 | cmd | # Suppress FORFILES "no files found" error
I'm working with a batch file to delete archived documents older than 14 days, and I'm calling the file from an automation process (Lansa Composer) that reads the return code of the script to see if there was a problem. Here's the script:
```
@echo off
@Echo Deleting files o... | This should solve that issue:
```
@echo off
Echo Deleting files older than 14 days...
cd /d C:\Windows\System32
copy /b forfiles.exe "[file path...]\IDOC_ARCHIVE" >nul
FORFILES /P "[file path...]\IDOC_ARCHIVE" /M *.* /D -14 /C "cmd /c del @file"
```
What it does is provide a file older than 14 days - so it will alway... |
34524390 | Regex to match a variable in Batch scripting | 22 | 2015-12-30 06:49:00 | <pre><code>@echo off
SET /p var=Enter:
echo %var% | findstr /r "^[a-z]{2,3}$">nul 2>&1
if errorlevel 1 (echo does not contain) else (echo contains)
pause
</code></pre>
<p>I'm trying to valid a input which should contain 2 or 3 letters. But I tried all the possible answer, it only runs <code>if error level ... | 75,227 | 3,666,807 | 2020-04-18 05:05:32 | 34,525,752 | 15 | 2015-12-30 08:32:06 | 2,152,082 | 2015-12-30 08:32:06 | https://stackoverflow.com/q/34524390 | https://stackoverflow.com/a/34525752 | <p><code>findstr</code> has no full REGEX Support. Especially no <code>{Count}</code>. You have to use a workaround:</p>
<pre><code>echo %var%|findstr /r "^[a-z][a-z]$ ^[a-z][a-z][a-z]$"
</code></pre>
<p>which searches for <code>^[a-z][a-z]$</code> OR <code>^[a-z][a-z][a-z]$</code></p>
<p>(Note: there is no space be... | <p><code>findstr</code> has no full REGEX Support. Especially no <code>{Count}</code>. You have to use a workaround:</p> <pre><code>echo %var%|findstr /r "^[a-z][a-z]$ ^[a-z][a-z][a-z]$" </code></pre> <p>which searches for <code>^[a-z][a-z]$</code> OR <code>^[a-z][a-z][a-z]$</code></p> <p>(Note: there is no space be... | 18, 7002 | batch-file, regex | <h1>Regex to match a variable in Batch scripting</h1>
<pre><code>@echo off
SET /p var=Enter:
echo %var% | findstr /r "^[a-z]{2,3}$">nul 2>&1
if errorlevel 1 (echo does not contain) else (echo contains)
pause
</code></pre>
<p>I'm trying to valid a input which should contain 2 or 3 letters. But I tried all t... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,199 | cmd | # Regex to match a variable in Batch scripting
```
@echo off
SET /p var=Enter:
echo %var% | findstr /r "^[a-z]{2,3}$">nul 2>&1
if errorlevel 1 (echo does not contain) else (echo contains)
pause
```
I'm trying to valid a input which should contain 2 or 3 letters. But I tried all the possible answer, it only runs `if... | `findstr` has no full REGEX Support. Especially no `{Count}`. You have to use a workaround:
```
echo %var%|findstr /r "^[a-z][a-z]$ ^[a-z][a-z][a-z]$"
```
which searches for `^[a-z][a-z]$` OR `^[a-z][a-z][a-z]$`
(Note: there is no space between `%var%` and `|` - it would be part of the string) |
25404485 | Get IP from MAC address. arp -a not showing device | 21 | 2014-08-20 12:16:46 | <p>I'm trying to write a batch file that's supposed to find the dynamically assigned IP of my Android phone when it's connected to the network (Tenda WiFi router). </p>
<p>So I'm trying <code>arp -a</code> and searching for my phone's MAC address so I can get its IP from the table.</p>
<pre><code>C:\Users\Leeroy>a... | 126,695 | 1,318,227 | 2019-07-05 10:42:50 | 25,405,842 | 15 | 2014-08-20 13:19:56 | 3,940,696 | 2014-08-20 17:10:18 | https://stackoverflow.com/q/25404485 | https://stackoverflow.com/a/25405842 | <p>I have tried this and it works:</p>
<pre><code>for /L %N in (1,1,254) do start /b ping -n 1 -w 200 192.168.0.%N
</code></pre>
<p>provided the phone has ICMP enabled, you should have no problem.</p>
| <p>I have tried this and it works:</p> <pre><code>for /L %N in (1,1,254) do start /b ping -n 1 -w 200 192.168.0.%N </code></pre> <p>provided the phone has ICMP enabled, you should have no problem.</p> | 64, 794, 1231, 7002, 14820 | arp, batch-file, command-line, network-programming, windows | <h1>Get IP from MAC address. arp -a not showing device</h1>
<p>I'm trying to write a batch file that's supposed to find the dynamically assigned IP of my Android phone when it's connected to the network (Tenda WiFi router). </p>
<p>So I'm trying <code>arp -a</code> and searching for my phone's MAC address so I can get... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,200 | cmd | # Get IP from MAC address. arp -a not showing device
I'm trying to write a batch file that's supposed to find the dynamically assigned IP of my Android phone when it's connected to the network (Tenda WiFi router).
So I'm trying `arp -a` and searching for my phone's MAC address so I can get its IP from the table.
```... | I have tried this and it works:
```
for /L %N in (1,1,254) do start /b ping -n 1 -w 200 192.168.0.%N
```
provided the phone has ICMP enabled, you should have no problem. |
4825746 | cmd.exe: when to use call to run external programs | 19 | 2011-01-28 07:08:47 | <p>It seems that a cmd script containing:</p>
<pre><code>prog1
prog2
</code></pre>
<p>does the same as </p>
<pre><code>call prog1
call prog2
</code></pre>
<p>What is the point of using the CALL command ?</p>
| 29,375 | 37,367 | 2015-08-25 22:26:01 | 4,825,773 | 15 | 2011-01-28 07:13:12 | 77,939 | 2011-01-28 07:13:12 | https://stackoverflow.com/q/4825746 | https://stackoverflow.com/a/4825773 | <p>You should use <code>call</code> when you need to call another batch program (cmd script). Using 'call' will have no effect if <code>prog1</code> is an executable file. (<code>prog1.exe</code>)</p>
<p>If you, for example, have two scripts:</p>
<pre><code>cmd1.cmd
cmd2.cmd
</code></pre>
<p>And within <code>cmd1.cm... | <p>You should use <code>call</code> when you need to call another batch program (cmd script). Using 'call' will have no effect if <code>prog1</code> is an executable file. (<code>prog1.exe</code>)</p> <p>If you, for example, have two scripts:</p> <pre><code>cmd1.cmd cmd2.cmd </code></pre> <p>And within <code>cmd1.cm... | 2631 | cmd | <h1>cmd.exe: when to use call to run external programs</h1>
<p>It seems that a cmd script containing:</p>
<pre><code>prog1
prog2
</code></pre>
<p>does the same as </p>
<pre><code>call prog1
call prog2
</code></pre>
<p>What is the point of using the CALL command ?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,201 | cmd | # cmd.exe: when to use call to run external programs
It seems that a cmd script containing:
```
prog1
prog2
```
does the same as
```
call prog1
call prog2
```
What is the point of using the CALL command ? | You should use `call` when you need to call another batch program (cmd script). Using 'call' will have no effect if `prog1` is an executable file. (`prog1.exe`)
If you, for example, have two scripts:
```
cmd1.cmd
cmd2.cmd
```
And within `cmd1.cmd` you have a line:
```
cmd2.cmd
```
... then your script will stop as... |
4632891 | Exiting batch with `EXIT /B X` where X>=1 acts as if command completed successfully when using && or || operators between batch calls | 19 | 2011-01-08 07:24:34 | <p>I'm trying to chain a series of .bat files using the <code>EXIT /B X</code> command to return success or failure and <code>&&</code> and <code>||</code> for conditional running of the next .bat (e.g. <code>a.bat && b.bat</code>).</p>
<p>Regardless of whether I call <code>EXIT /B 0</code> or anything... | 17,059 | 541,251 | 2018-08-23 09:52:57 | 4,636,460 | 15 | 2011-01-08 22:16:27 | 3,501 | 2011-01-08 22:16:27 | https://stackoverflow.com/q/4632891 | https://stackoverflow.com/a/4636460 | <p>If you ask me, exit codes in batch files are broken for this exact reason, but there is a hacky workaround you can use. As the last line of your batch file, use:</p>
<pre><code>@%COMSPEC% /C exit 1 >nul
</code></pre>
<p>Since this is an actual process that is started you get a real process exit code and &&a... | <p>If you ask me, exit codes in batch files are broken for this exact reason, but there is a hacky workaround you can use. As the last line of your batch file, use:</p> <pre><code>@%COMSPEC% /C exit 1 >nul </code></pre> <p>Since this is an actual process that is started you get a real process exit code and &&a... | 64, 2631, 7002, 10871, 17564 | batch-file, cmd, errorlevel, exit, windows | <h1>Exiting batch with `EXIT /B X` where X>=1 acts as if command completed successfully when using && or || operators between batch calls</h1>
<p>I'm trying to chain a series of .bat files using the <code>EXIT /B X</code> command to return success or failure and <code>&&</code> and <code>||</code> for condition... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,202 | cmd | # Exiting batch with `EXIT /B X` where X>=1 acts as if command completed successfully when using && or || operators between batch calls
I'm trying to chain a series of .bat files using the `EXIT /B X` command to return success or failure and `&&` and `||` for conditional running of the next .bat (e.g. `a.bat && b.bat`... | If you ask me, exit codes in batch files are broken for this exact reason, but there is a hacky workaround you can use. As the last line of your batch file, use:
```
@%COMSPEC% /C exit 1 >nul
```
Since this is an actual process that is started you get a real process exit code and && and || will work. |
31432189 | Downloading artifacts from Jenkins using wget or curl | 18 | 2015-07-15 13:44:21 | <p>I am trying to download an artifact from a Jenkins project using a DOS batch script. The reason that this is more than trivial is that my artifact is a ZIP file which includes the Jenkins build number in its name, hence I don't know the exact file name.</p>
<p>My current plan of attack is to use wget pointing at: /... | 42,475 | 4,385,264 | 2018-07-18 19:46:26 | 31,434,010 | 15 | 2015-07-15 15:00:41 | 1,720,943 | 2018-07-18 19:22:03 | https://stackoverflow.com/q/31432189 | https://stackoverflow.com/a/31434010 | <p>You can add <code>/*zip*/desired_archive_name.zip</code> to any folder of the artifacts location.</p>
<p>If your ZIP file is the only artifact that the job archives, you can use:</p>
<p><code>http://*.*.*.*:8080/job/MyProject/lastSuccessfulBuild/artifact/*zip*/myfile.zip</code></p>
<p>where <code>myfile.zip</code... | <p>You can add <code>/*zip*/desired_archive_name.zip</code> to any folder of the artifacts location.</p> <p>If your ZIP file is the only artifact that the job archives, you can use:</p> <p><code>http://*.*.*.*:8080/job/MyProject/lastSuccessfulBuild/artifact/*zip*/myfile.zip</code></p> <p>where <code>myfile.zip</code... | 1554, 3909, 5583, 7002, 64999 | artifacts, batch-file, curl, jenkins, wget | <h1>Downloading artifacts from Jenkins using wget or curl</h1>
<p>I am trying to download an artifact from a Jenkins project using a DOS batch script. The reason that this is more than trivial is that my artifact is a ZIP file which includes the Jenkins build number in its name, hence I don't know the exact file name.<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,203 | cmd | # Downloading artifacts from Jenkins using wget or curl
I am trying to download an artifact from a Jenkins project using a DOS batch script. The reason that this is more than trivial is that my artifact is a ZIP file which includes the Jenkins build number in its name, hence I don't know the exact file name.
My curre... | You can add `/*zip*/desired_archive_name.zip` to any folder of the artifacts location.
If your ZIP file is the only artifact that the job archives, you can use:
`http://*.*.*.*:8080/job/MyProject/lastSuccessfulBuild/artifact/*zip*/myfile.zip`
where `myfile.zip` is just a name you assign to the downloadable archive, ... |
1042111 | batch file to wait for a installation to complete before moving to the next line | 18 | 2009-06-25 03:58:45 | <p>I have a batch file that will detect if the user has the .Net framework installed by going to the directory and checking if the CONFIG directory exists.</p>
<p>If the directory doesn't exist then the user doesn't have the .Net framework installed. The batch file will then continue on to install the .Net framework. ... | 73,039 | 70,942 | 2011-03-15 20:22:38 | 1,042,142 | 15 | 2009-06-25 04:11:48 | 124,119 | 2009-06-25 04:17:12 | https://stackoverflow.com/q/1042111 | https://stackoverflow.com/a/1042142 | <p>you can use </p>
<pre><code>START /WAIT NetFx20SP2_x86
</code></pre>
<p>too.
remember that</p>
<pre><code>REM comment
</code></pre>
<p>is equal to</p>
<pre><code>::comment
</code></pre>
<p>and that using .\ is unnecessary, and file extensions are too, unless there are dirs/files with conflicting names.
You als... | <p>you can use </p> <pre><code>START /WAIT NetFx20SP2_x86 </code></pre> <p>too. remember that</p> <pre><code>REM comment </code></pre> <p>is equal to</p> <pre><code>::comment </code></pre> <p>and that using .\ is unnecessary, and file extensions are too, unless there are dirs/files with conflicting names. You als... | 7002 | batch-file | <h1>batch file to wait for a installation to complete before moving to the next line</h1>
<p>I have a batch file that will detect if the user has the .Net framework installed by going to the directory and checking if the CONFIG directory exists.</p>
<p>If the directory doesn't exist then the user doesn't have the .Net... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,206 | cmd | # batch file to wait for a installation to complete before moving to the next line
I have a batch file that will detect if the user has the .Net framework installed by going to the directory and checking if the CONFIG directory exists.
If the directory doesn't exist then the user doesn't have the .Net framework insta... | you can use
```
START /WAIT NetFx20SP2_x86
```
too.
remember that
```
REM comment
```
is equal to
```
::comment
```
and that using .\ is unnecessary, and file extensions are too, unless there are dirs/files with conflicting names.
You also do not need cleaning the "filename" variable twice (the "=" pointing nothi... |
51540008 | Angular - TypeError: Cannot read property 'write' of undefined | 17 | 2018-07-26 13:25:45 | <p>I'm working on a club project and we are using angular for our platform, I'm just doing front-end homepage stuff, so technically I just use the angular stuff to run and test.</p>
<p>It was working fine but now everytime I run <code>ng build --watch</code> I get this error:</p>
<pre><code>C:\Users\User\Documents\We... | 21,435 | 9,158,665 | 2019-03-31 10:32:22 | 51,547,056 | 15 | 2018-07-26 20:28:49 | 8,670,700 | 2018-08-20 13:27:59 | https://stackoverflow.com/q/51540008 | https://stackoverflow.com/a/51547056 | <p>Seems to be caused by latest version of Angular CLI (released today). I worked around it by installing previous version (6.0.8) globally.</p>
<p><strong>Update:</strong></p>
<p>As per <strong>prionp</strong> answer below:</p>
<p>Angular CLI v6.1.2 fixed the issue.</p>
<p>Update your version :</p>
<pre><code>npm... | <p>Seems to be caused by latest version of Angular CLI (released today). I worked around it by installing previous version (6.0.8) globally.</p> <p><strong>Update:</strong></p> <p>As per <strong>prionp</strong> answer below:</p> <p>Angular CLI v6.1.2 fixed the issue.</p> <p>Update your version :</p> <pre><code>npm... | 391, 2631, 46426, 125866 | angular, cmd, node.js, terminal | <h1>Angular - TypeError: Cannot read property 'write' of undefined</h1>
<p>I'm working on a club project and we are using angular for our platform, I'm just doing front-end homepage stuff, so technically I just use the angular stuff to run and test.</p>
<p>It was working fine but now everytime I run <code>ng build --w... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,207 | cmd | # Angular - TypeError: Cannot read property 'write' of undefined
I'm working on a club project and we are using angular for our platform, I'm just doing front-end homepage stuff, so technically I just use the angular stuff to run and test.
It was working fine but now everytime I run `ng build --watch` I get this erro... | Seems to be caused by latest version of Angular CLI (released today). I worked around it by installing previous version (6.0.8) globally.
**Update:**
As per **prionp** answer below:
Angular CLI v6.1.2 fixed the issue.
Update your version :
```
npm update -g @angular/cli
``` |
26552368 | Windows Batch file - taskkill if window title contains text | 17 | 2014-10-24 16:37:18 | <p>I want to write a simple batch file to kill a process that contains certain text in the window title. Right now I have: </p>
<pre><code>taskkill /fi "Windowtitle eq XXXX*" /im cmd.exe
</code></pre>
<p>And that works, except what I want to do is use the wildcard both at the beginning AND end of the title. So som... | 24,876 | 2,686,419 | 2023-01-29 06:38:24 | 26,552,603 | 15 | 2014-10-24 16:52:24 | 2,861,476 | 2014-10-24 16:52:24 | https://stackoverflow.com/q/26552368 | https://stackoverflow.com/a/26552603 | <p>No, wildcards are not allowed at the start of the filter.</p>
<pre><code>for /f "tokens=2 delims=," %%a in ('
tasklist /fi "imagename eq cmd.exe" /v /fo:csv /nh
^| findstr /r /c:".*X[^,]*$"
') do taskkill /pid %%a
</code></pre>
<p>This will retrieve the list of tasks, in csv and verbose format (that will ... | <p>No, wildcards are not allowed at the start of the filter.</p> <pre><code>for /f "tokens=2 delims=," %%a in (' tasklist /fi "imagename eq cmd.exe" /v /fo:csv /nh ^| findstr /r /c:".*X[^,]*$" ') do taskkill /pid %%a </code></pre> <p>This will retrieve the list of tasks, in csv and verbose format (that will ... | 64, 2631, 5910, 7002, 12488 | batch-file, cmd, process, taskkill, windows | <h1>Windows Batch file - taskkill if window title contains text</h1>
<p>I want to write a simple batch file to kill a process that contains certain text in the window title. Right now I have: </p>
<pre><code>taskkill /fi "Windowtitle eq XXXX*" /im cmd.exe
</code></pre>
<p>And that works, except what I want to do i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,208 | cmd | # Windows Batch file - taskkill if window title contains text
I want to write a simple batch file to kill a process that contains certain text in the window title. Right now I have:
```
taskkill /fi "Windowtitle eq XXXX*" /im cmd.exe
```
And that works, except what I want to do is use the wildcard both at the beginn... | No, wildcards are not allowed at the start of the filter.
```
for /f "tokens=2 delims=," %%a in ('
tasklist /fi "imagename eq cmd.exe" /v /fo:csv /nh
^| findstr /r /c:".*X[^,]*$"
') do taskkill /pid %%a
```
This will retrieve the list of tasks, in csv and verbose format (that will include window title as the... |
2594447 | Opening A Specific File With A Batch File? | 17 | 2010-04-07 17:08:36 | <p>I'm would like to know how I can open a specific file using a specific program with a batch file. So far, my batch file can open the program, but I'm not sure how to open a file with that program.</p>
<pre><code>@echo off
start wgnuplot.exe
</code></pre>
| 247,711 | 281,671 | 2020-11-25 05:42:59 | 2,594,459 | 15 | 2010-04-07 17:10:01 | 289,135 | 2010-04-07 17:10:01 | https://stackoverflow.com/q/2594447 | https://stackoverflow.com/a/2594459 | <pre><code>start wgnplot.exe "c:\path to file to open\foo.dat"
</code></pre>
| <pre><code>start wgnplot.exe "c:\path to file to open\foo.dat" </code></pre> | 5310, 7002 | batch-file, file | <h1>Opening A Specific File With A Batch File?</h1>
<p>I'm would like to know how I can open a specific file using a specific program with a batch file. So far, my batch file can open the program, but I'm not sure how to open a file with that program.</p>
<pre><code>@echo off
start wgnuplot.exe
</code></pre>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,209 | cmd | # Opening A Specific File With A Batch File?
I'm would like to know how I can open a specific file using a specific program with a batch file. So far, my batch file can open the program, but I'm not sure how to open a file with that program.
```
@echo off
start wgnuplot.exe
``` | ```
start wgnplot.exe "c:\path to file to open\foo.dat"
``` |
7712661 | Windows .bat/.cmd function library in own file? | 16 | 2011-10-10 12:21:36 | <p>there is <a href="http://www.dostips.com/DtTutoFunctions.php" rel="noreferrer">a nice way to build functions</a> in DOS .bat/.cmd script. To modularize some installation scripts, it would be nice to include a file with a library of functions into an .bat/.cmd script.</p>
<p>what I tried was: </p>
<p>mainscript.bat... | 10,451 | 375,251 | 2021-01-04 16:42:43 | 7,715,833 | 15 | 2011-10-10 16:28:44 | 463,115 | 2018-09-15 16:24:16 | https://stackoverflow.com/q/7712661 | https://stackoverflow.com/a/7715833 | <p>It's possible, and there are some different ways to do it. </p>
<p>1) Copy&Paste the complete "Library" into each of your files
Works, but it's not really a library, and it's a horror to change/correct a library function in all files</p>
<p>2) include a library via call-wrapper</p>
<pre><code>call batchLib.b... | <p>It's possible, and there are some different ways to do it. </p> <p>1) Copy&Paste the complete "Library" into each of your files Works, but it's not really a library, and it's a horror to change/correct a library function in all files</p> <p>2) include a library via call-wrapper</p> <pre><code>call batchLib.b... | 64, 5569, 7002 | batch-file, function, windows | <h1>Windows .bat/.cmd function library in own file?</h1>
<p>there is <a href="http://www.dostips.com/DtTutoFunctions.php" rel="noreferrer">a nice way to build functions</a> in DOS .bat/.cmd script. To modularize some installation scripts, it would be nice to include a file with a library of functions into an .bat/.cmd ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,210 | cmd | # Windows .bat/.cmd function library in own file?
there is [a nice way to build functions](http://www.dostips.com/DtTutoFunctions.php) in DOS .bat/.cmd script. To modularize some installation scripts, it would be nice to include a file with a library of functions into an .bat/.cmd script.
what I tried was:
mainscrip... | It's possible, and there are some different ways to do it.
1) Copy&Paste the complete "Library" into each of your files
Works, but it's not really a library, and it's a horror to change/correct a library function in all files
2) include a library via call-wrapper
```
call batchLib.bat :length result "abcdef"
```
an... |
33118398 | Windows Batch - Pretty Print JSON per Script | 15 | 2015-10-14 06:47:16 | <p>I have multiple JSON-files on a server, which can only run batch-scripts or command-line tools. The JSON files all aren't formatted properly, meaning there are no tab-spaces at the beginning of lines.</p>
<p>Is there a way, to write a batch-script or run a command-line tool to format the files, so they are normal a... | 22,306 | 5,417,542 | 2025-03-23 20:19:33 | 33,123,564 | 15 | 2015-10-14 10:59:26 | 1,529,709 | 2020-07-29 15:58:32 | https://stackoverflow.com/q/33118398 | https://stackoverflow.com/a/33123564 | <p>You will definitely need an external tool for that. I'm using the <a href="https://stedolan.github.io/jq/" rel="noreferrer">command-line JSON processor <code>jq</code></a> - just pass it the Identity filter <code>.</code> and it will pretty print the JSON it's been given as input.</p>
<p><em>Update:</em> Corrected s... | <p>You will definitely need an external tool for that. I'm using the <a href="https://stedolan.github.io/jq/" rel="noreferrer">command-line JSON processor <code>jq</code></a> - just pass it the Identity filter <code>.</code> and it will pretty print the JSON it's been given as input.</p> <p><em>Update:</em> Corrected s... | 531, 1231, 1508, 7002 | batch-file, command-line, json, scripting | <h1>Windows Batch - Pretty Print JSON per Script</h1>
<p>I have multiple JSON-files on a server, which can only run batch-scripts or command-line tools. The JSON files all aren't formatted properly, meaning there are no tab-spaces at the beginning of lines.</p>
<p>Is there a way, to write a batch-script or run a comma... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,212 | cmd | # Windows Batch - Pretty Print JSON per Script
I have multiple JSON-files on a server, which can only run batch-scripts or command-line tools. The JSON files all aren't formatted properly, meaning there are no tab-spaces at the beginning of lines.
Is there a way, to write a batch-script or run a command-line tool to ... | You will definitely need an external tool for that. I'm using the [command-line JSON processor `jq`](https://stedolan.github.io/jq/) - just pass it the Identity filter `.` and it will pretty print the JSON it's been given as input.
*Update:* Corrected syntax (where did that come from?), Sorry @Delfic and @Sonata. Even... |
24929879 | Sencha Cmd build - Failed creating background process | 15 | 2014-07-24 09:24:09 | <p>I'm trying to build extjs5 application with Cmd v5.0.0.160.</p>
<p>I have ruby2.0 installed and sencha cmd on my PATH var.</p>
<p>Here is the error that I get when running <code>sencha app build</code>:</p>
<pre><code>...
[INF] Capturing theme image
[ERR]
[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.ExProcess:... | 13,880 | 499,780 | 2022-05-22 05:48:15 | 24,933,389 | 15 | 2014-07-24 12:13:46 | 1,467,976 | 2014-07-24 12:13:46 | https://stackoverflow.com/q/24929879 | https://stackoverflow.com/a/24933389 | <p>It's a really annoying bug in Sencha CMD 5 - they swallow the output of any processes they launch. </p>
<p>Or, more accurately, they route the output to the debug logs. So you can see what's going on if you turn debug logging on. Try <code>sencha -d app build</code> - just be prepared to trawl through a lot of outp... | <p>It's a really annoying bug in Sencha CMD 5 - they swallow the output of any processes they launch. </p> <p>Or, more accurately, they route the output to the debug logs. So you can see what's going on if you turn debug logging on. Try <code>sencha -d app build</code> - just be prepared to trawl through a lot of outp... | 4025, 87610, 103663 | extjs, extjs5, sencha-cmd | <h1>Sencha Cmd build - Failed creating background process</h1>
<p>I'm trying to build extjs5 application with Cmd v5.0.0.160.</p>
<p>I have ruby2.0 installed and sencha cmd on my PATH var.</p>
<p>Here is the error that I get when running <code>sencha app build</code>:</p>
<pre><code>...
[INF] Capturing theme image
[... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,213 | cmd | # Sencha Cmd build - Failed creating background process
I'm trying to build extjs5 application with Cmd v5.0.0.160.
I have ruby2.0 installed and sencha cmd on my PATH var.
Here is the error that I get when running `sencha app build`:
```
...
[INF] Capturing theme image
[ERR]
[ERR] BUILD FAILED
[ERR] com.sencha.exc... | It's a really annoying bug in Sencha CMD 5 - they swallow the output of any processes they launch.
Or, more accurately, they route the output to the debug logs. So you can see what's going on if you turn debug logging on. Try `sencha -d app build` - just be prepared to trawl through a lot of output. |
1916050 | If Service Exists Condition | 15 | 2009-12-16 16:55:15 | <p>How would you check if a WIN32 service exists and, if so, do some operation?</p>
| 38,838 | 76,439 | 2020-11-10 14:19:36 | 1,916,149 | 15 | 2009-12-16 17:10:08 | 218,597 | 2009-12-22 10:45:48 | https://stackoverflow.com/q/1916050 | https://stackoverflow.com/a/1916149 | <p>Off the top of my head, you can check if a specific service is running, as mentioned by bmargulies, using the "net" command, piping the result into "find".
Something like the following would check if a service was running, and if so stop it. You can then start it without worrying about if it was already running or n... | <p>Off the top of my head, you can check if a specific service is running, as mentioned by bmargulies, using the "net" command, piping the result into "find". Something like the following would check if a service was running, and if so stop it. You can then start it without worrying about if it was already running or n... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>If Service Exists Condition</h1>
<p>How would you check if a WIN32 service exists and, if so, do some operation?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,214 | cmd | # If Service Exists Condition
How would you check if a WIN32 service exists and, if so, do some operation? | Off the top of my head, you can check if a specific service is running, as mentioned by bmargulies, using the "net" command, piping the result into "find".
Something like the following would check if a service was running, and if so stop it. You can then start it without worrying about if it was already running or not:... |
48355319 | Cmd Windows "python" command works, but "python3" doesn't although my python version is 3.6 | 14 | 2018-01-20 11:03:04 | <p>So I have followed a couple of posts here such as <a href="https://stackoverflow.com/questions/17953124/python-is-not-recognized-as-an-internal-or-external-command">this</a>.</p>
<p>So I have installed python 3.6 with Anaconda. Then I went into the PATH and I inserted the path to Python. </p>
<p>So now when I typ... | 28,630 | 6,435,921 | 2018-01-20 12:55:55 | 48,356,397 | 15 | 2018-01-20 12:55:55 | 9,193,481 | 2018-01-20 12:55:55 | https://stackoverflow.com/q/48355319 | https://stackoverflow.com/a/48356397 | <p>Your question may have already been answered; see <a href="https://stackoverflow.com/a/34223417">this answer to: Python 3 installation on windows running from command line</a>. Specifically:</p>
<blockquote>
<p>OSX and Linux have <code>python</code> executable installed by default as a rule
and it refers to Pyt... | <p>Your question may have already been answered; see <a href="https://stackoverflow.com/a/34223417">this answer to: Python 3 installation on windows running from command line</a>. Specifically:</p> <blockquote> <p>OSX and Linux have <code>python</code> executable installed by default as a rule and it refers to Pyt... | 16, 64, 2631, 92746, 107329 | anaconda, cmd, python, windows, windows-10 | <h1>Cmd Windows "python" command works, but "python3" doesn't although my python version is 3.6</h1>
<p>So I have followed a couple of posts here such as <a href="https://stackoverflow.com/questions/17953124/python-is-not-recognized-as-an-internal-or-external-command">this</a>.</p>
<p>So I have installed python 3.6 wi... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,215 | cmd | # Cmd Windows "python" command works, but "python3" doesn't although my python version is 3.6
So I have followed a couple of posts here such as [this](https://stackoverflow.com/questions/17953124/python-is-not-recognized-as-an-internal-or-external-command).
So I have installed python 3.6 with Anaconda. Then I went in... | Your question may have already been answered; see [this answer to: Python 3 installation on windows running from command line](https://stackoverflow.com/a/34223417). Specifically:
> OSX and Linux have `python` executable installed by default as a rule
> and it refers to Python 2 version in most cases at the moment tha... |
42545028 | Open xz file from the command line in Windows 10 | 14 | 2017-03-02 01:01:11 | <p>My colleagues using mac or linux open xz files with this line:</p>
<pre><code>xz --decompress --stdout "file.csv.xz"
</code></pre>
<p>On my pc, with windows 10, I get the following error:</p>
<blockquote>
<p>'xz' is not recognized as an internal or external command, operable program or batch file</p>
</blockquo... | 42,589 | 4,745,124 | 2017-03-02 15:06:47 | 42,558,953 | 15 | 2017-03-02 15:06:47 | 447,901 | 2017-03-02 15:06:47 | https://stackoverflow.com/q/42545028 | https://stackoverflow.com/a/42558953 | <p>Yes, you need to install <code>xz</code> on the computer in order to run it. <a href="http://tukaani.org/xz/" rel="noreferrer">http://tukaani.org/xz/</a></p>
<p>7-Zip has supported .xz files for some time and you might be able to use that if it is already installed. <a href="http://www.7-zip.org/" rel="noreferrer">... | <p>Yes, you need to install <code>xz</code> on the computer in order to run it. <a href="http://tukaani.org/xz/" rel="noreferrer">http://tukaani.org/xz/</a></p> <p>7-Zip has supported .xz files for some time and you might be able to use that if it is already installed. <a href="http://www.7-zip.org/" rel="noreferrer">... | 2631, 48840, 107329 | cmd, windows-10, xz | <h1>Open xz file from the command line in Windows 10</h1>
<p>My colleagues using mac or linux open xz files with this line:</p>
<pre><code>xz --decompress --stdout "file.csv.xz"
</code></pre>
<p>On my pc, with windows 10, I get the following error:</p>
<blockquote>
<p>'xz' is not recognized as an internal or exter... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,216 | cmd | # Open xz file from the command line in Windows 10
My colleagues using mac or linux open xz files with this line:
```
xz --decompress --stdout "file.csv.xz"
```
On my pc, with windows 10, I get the following error:
> 'xz' is not recognized as an internal or external command, operable program or batch file
Is the c... | Yes, you need to install `xz` on the computer in order to run it. <http://tukaani.org/xz/>
7-Zip has supported .xz files for some time and you might be able to use that if it is already installed. <http://www.7-zip.org/> |
31416438 | How to auto-hide the taskbar from the command line | 14 | 2015-07-14 20:16:34 | <p>Does anyone know how I can automatically hide the task bar in windows 7 via command line or some other method?</p>
| 35,664 | 2,743,083 | 2023-08-25 19:01:32 | 31,416,792 | 15 | 2015-07-14 20:36:03 | 3,213,868 | 2015-07-14 21:36:45 | https://stackoverflow.com/q/31416438 | https://stackoverflow.com/a/31416792 | <p>Here's a little C program that will toggle the hidden/shown state of the taskbar window. Note that when it's hidden it's actually gone from the screen completely (it's not in auto-hide mode).</p>
<pre><code>#include <windows.h>
int main() {
HWND hwnd = FindWindow("Shell_traywnd", "");
if (IsWindowVis... | <p>Here's a little C program that will toggle the hidden/shown state of the taskbar window. Note that when it's hidden it's actually gone from the screen completely (it's not in auto-hide mode).</p> <pre><code>#include <windows.h> int main() { HWND hwnd = FindWindow("Shell_traywnd", ""); if (IsWindowVis... | 64, 2631, 2855, 34595 | cmd, taskbar, windows, windows-7 | <h1>How to auto-hide the taskbar from the command line</h1>
<p>Does anyone know how I can automatically hide the task bar in windows 7 via command line or some other method?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,217 | cmd | # How to auto-hide the taskbar from the command line
Does anyone know how I can automatically hide the task bar in windows 7 via command line or some other method? | Here's a little C program that will toggle the hidden/shown state of the taskbar window. Note that when it's hidden it's actually gone from the screen completely (it's not in auto-hide mode).
```
#include <windows.h>
int main() {
HWND hwnd = FindWindow("Shell_traywnd", "");
if (IsWindowVisible(hwnd))
... |
8690245 | ROBOCOPY - Copy folders content to a single folder | 14 | 2011-12-31 19:54:59 | <p>Here is some code I made :)</p>
<pre><code>@echo off
set source="R:\Contracts\"
set destination="R:\Contracts\Sites\"
ROBOCOPY %source% %destination% *.srt *.pdf *.mp4 *.jpg /COPYALL /R:0 /S
for /r %source in (*) do @copy "%destination" .
</code></pre>
<p>R:\Contracts\ is full of folders which have files in them.<... | 69,116 | 1,114,491 | 2022-11-25 18:10:46 | 8,691,073 | 15 | 2011-12-31 23:31:17 | 1,012,053 | 2012-01-03 12:10:27 | https://stackoverflow.com/q/8690245 | https://stackoverflow.com/a/8691073 | <p>No single command will flatten the hierarchy for you; you will have to use multiple commands. It can be done simply by using FOR /R to walk the hierarchy, coupled with your copy/move command of choice (move, copy, xcopy, robocopy). Because your destination is within the source hierarchy, you need an IF to prevent th... | <p>No single command will flatten the hierarchy for you; you will have to use multiple commands. It can be done simply by using FOR /R to walk the hierarchy, coupled with your copy/move command of choice (move, copy, xcopy, robocopy). Because your destination is within the source hierarchy, you need an IF to prevent th... | 4330, 5310, 7002, 11635 | batch-file, copy, file, robocopy | <h1>ROBOCOPY - Copy folders content to a single folder</h1>
<p>Here is some code I made :)</p>
<pre><code>@echo off
set source="R:\Contracts\"
set destination="R:\Contracts\Sites\"
ROBOCOPY %source% %destination% *.srt *.pdf *.mp4 *.jpg /COPYALL /R:0 /S
for /r %source in (*) do @copy "%destination" .
</code></pre>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,218 | cmd | # ROBOCOPY - Copy folders content to a single folder
Here is some code I made :)
```
@echo off
set source="R:\Contracts\"
set destination="R:\Contracts\Sites\"
ROBOCOPY %source% %destination% *.srt *.pdf *.mp4 *.jpg /COPYALL /R:0 /S
for /r %source in (*) do @copy "%destination" .
```
R:\Contracts\ is full of folders... | No single command will flatten the hierarchy for you; you will have to use multiple commands. It can be done simply by using FOR /R to walk the hierarchy, coupled with your copy/move command of choice (move, copy, xcopy, robocopy). Because your destination is within the source hierarchy, you need an IF to prevent the d... |
39679344 | Check if a string variable is empty in batch script | 13 | 2016-09-24 17:55:58 | <p>I am trying to write a batch script to get a string in a variable and check if it is empty, and if it is empty then it is directed to a loop. The below code represents the problem</p>
<pre><code>:loop
set /p cide=
IF NOT "a%1"=="a" (set cide="%1")
IF [%1]==[] goto loop
ELSE
echo IDE entered
TIMEOUT 5 > NUL
</cod... | 71,579 | 3,780,351 | 2019-01-04 05:53:00 | 39,679,719 | 15 | 2016-09-24 18:38:13 | 3,080,770 | 2016-09-24 18:38:13 | https://stackoverflow.com/q/39679344 | https://stackoverflow.com/a/39679719 | <p>You can try something like that :</p>
<pre class="lang-dos prettyprint-override"><code>@echo off
:loop
cls & Color 0A
echo Type what you want !
set /p "cide="
IF "%cide%"=="" (
Cls & Color 0C
echo You must enter something
Timeout /T 2 /NoBreak>nul
goto loop
) ELSE (
Goto Next
)
:Nex... | <p>You can try something like that :</p> <pre class="lang-dos prettyprint-override"><code>@echo off :loop cls & Color 0A echo Type what you want ! set /p "cide=" IF "%cide%"=="" ( Cls & Color 0C echo You must enter something Timeout /T 2 /NoBreak>nul goto loop ) ELSE ( Goto Next ) :Nex... | 2773, 7002 | batch-file, if-statement | <h1>Check if a string variable is empty in batch script</h1>
<p>I am trying to write a batch script to get a string in a variable and check if it is empty, and if it is empty then it is directed to a loop. The below code represents the problem</p>
<pre><code>:loop
set /p cide=
IF NOT "a%1"=="a" (set cide="%1")
IF [%1]... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,219 | cmd | # Check if a string variable is empty in batch script
I am trying to write a batch script to get a string in a variable and check if it is empty, and if it is empty then it is directed to a loop. The below code represents the problem
```
:loop
set /p cide=
IF NOT "a%1"=="a" (set cide="%1")
IF [%1]==[] goto loop
ELSE
... | You can try something like that :
```
@echo off
:loop
cls & Color 0A
echo Type what you want !
set /p "cide="
IF "%cide%"=="" (
Cls & Color 0C
echo You must enter something
Timeout /T 2 /NoBreak>nul
goto loop
) ELSE (
Goto Next
)
:Next
Cls
echo %cide% is entered
pause
``` |
19146651 | Batch file: How to get variable's value using variable's name already stored in a string | 13 | 2013-10-02 20:54:33 | <p>1) Quick example:</p>
<pre><code>set a="Hello"
set d="a"
</code></pre>
<p>Now, how do I get the value of "a" using (the value of) variable <code>d</code>? For example, the variable name could have been entered by a user using a prompt, or the name of the variable could have been sent to a function.</p>
<p>None ... | 34,573 | 1,596,274 | 2017-06-21 23:18:20 | 19,147,928 | 15 | 2013-10-02 22:35:06 | 2,098,699 | 2013-10-02 22:35:06 | https://stackoverflow.com/q/19146651 | https://stackoverflow.com/a/19147928 | <p>example without <code>delayed expansion</code> (preserves exclamation marks):</p>
<pre><code>@echo off &setlocal
set "a=Hello!"
set "d=a"
call echo %%%d%%%
</code></pre>
<hr>
<p>output:</p>
<pre><code>Hello!
</code></pre>
| <p>example without <code>delayed expansion</code> (preserves exclamation marks):</p> <pre><code>@echo off &setlocal set "a=Hello!" set "d=a" call echo %%%d%%% </code></pre> <hr> <p>output:</p> <pre><code>Hello! </code></pre> | 139, 276, 7002, 9938 | batch-file, command-prompt, string, variables | <h1>Batch file: How to get variable's value using variable's name already stored in a string</h1>
<p>1) Quick example:</p>
<pre><code>set a="Hello"
set d="a"
</code></pre>
<p>Now, how do I get the value of "a" using (the value of) variable <code>d</code>? For example, the variable name could have been entered by a ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,220 | cmd | # Batch file: How to get variable's value using variable's name already stored in a string
1) Quick example:
```
set a="Hello"
set d="a"
```
Now, how do I get the value of "a" using (the value of) variable `d`? For example, the variable name could have been entered by a user using a prompt, or the name of the variab... | example without `delayed expansion` (preserves exclamation marks):
```
@echo off &setlocal
set "a=Hello!"
set "d=a"
call echo %%%d%%%
```
---
output:
```
Hello!
``` |
34538825 | node.js call external exe and wait for output | 12 | 2015-12-30 23:25:57 | <p>I just want to call an external exe from a nodejs-App. This external exe makes some calculations and returns an output the nodejs-App needs. But I have no idea how to make the connection between nodejs and an external exe. So my questions:</p>
<ol>
<li>How do I call an external exe-file with specific arguments from... | 15,843 | 3,063,719 | 2024-07-08 10:03:09 | 34,539,036 | 15 | 2015-12-30 23:50:18 | 580,709 | 2015-12-30 23:50:18 | https://stackoverflow.com/q/34538825 | https://stackoverflow.com/a/34539036 | <ol>
<li>With <code>child_process</code> module.</li>
<li>With stdout.</li>
</ol>
<p>Code will look like this</p>
<pre><code>var exec = require('child_process').exec;
var result = '';
var child = exec('ping google.com');
child.stdout.on('data', function(data) {
result += data;
});
child.on('close', function()... | <ol> <li>With <code>child_process</code> module.</li> <li>With stdout.</li> </ol> <p>Code will look like this</p> <pre><code>var exec = require('child_process').exec; var result = ''; var child = exec('ping google.com'); child.stdout.on('data', function(data) { result += data; }); child.on('close', function()... | 3, 2631, 46426, 62301 | cmd, express, javascript, node.js | <h1>node.js call external exe and wait for output</h1>
<p>I just want to call an external exe from a nodejs-App. This external exe makes some calculations and returns an output the nodejs-App needs. But I have no idea how to make the connection between nodejs and an external exe. So my questions:</p>
<ol>
<li>How do I... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,221 | cmd | # node.js call external exe and wait for output
I just want to call an external exe from a nodejs-App. This external exe makes some calculations and returns an output the nodejs-App needs. But I have no idea how to make the connection between nodejs and an external exe. So my questions:
1. How do I call an external e... | 1. With `child_process` module.
2. With stdout.
Code will look like this
```
var exec = require('child_process').exec;
var result = '';
var child = exec('ping google.com');
child.stdout.on('data', function(data) {
result += data;
});
child.on('close', function() {
console.log('done');
console.log(resu... |
24722368 | system("cd <path>") in a C program | 12 | 2014-07-13 11:50:16 | <p><br>
I'm trying to use the system() function in a C program.<br>
For example, I tried to create a directory on my desktop, using the system() function.<br>My code:<br></p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
int main(void)
{
system("cd c:\\Users\\USER\\Desktop");
system("mkdir test"... | 19,328 | 3,096,157 | 2014-07-13 14:40:28 | 24,722,407 | 15 | 2014-07-13 11:53:17 | 964,243 | 2014-07-13 14:40:28 | https://stackoverflow.com/q/24722368 | https://stackoverflow.com/a/24722407 | <p>The changed directory only lasts for the duration of the system command. The command starts a separate program, which inherits its current directory from your program, but when that program exits its current directory dies with it.</p>
<p>You can use <code>&&</code> to join the commands together, and it wil... | <p>The changed directory only lasts for the duration of the system command. The command starts a separate program, which inherits its current directory from your program, but when that program exits its current directory dies with it.</p> <p>You can use <code>&&</code> to join the commands together, and it wil... | 8, 64, 2631, 3718, 5163 | c, cd, cmd, system, windows | <h1>system("cd <path>") in a C program</h1>
<p><br>
I'm trying to use the system() function in a C program.<br>
For example, I tried to create a directory on my desktop, using the system() function.<br>My code:<br></p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
int main(void)
{
system("cd c:\\Us... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,222 | cmd | # system("cd ") in a C program
I'm trying to use the system() function in a C program.
For example, I tried to create a directory on my desktop, using the system() function.
My code:
```
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
system("cd c:\\Users\\USER\\Desktop");
system("mkdir test");
... | The changed directory only lasts for the duration of the system command. The command starts a separate program, which inherits its current directory from your program, but when that program exits its current directory dies with it.
You can use `&&` to join the commands together, and it will work:
```
system("cd /D C:... |
24004300 | Batch-file get CPU temperature in °C and set as variable | 12 | 2014-06-02 22:28:20 | <p>How do i get a batch-file to work out the temperature of the Cpu and return it as a variable. I know it can be done as i have seen it been done. The solution can use any external tool. I have looked on Google for at least 2 hours but found nothing. Can any one help. Thanks.</p>
| 47,221 | 2,964,427 | 2018-01-31 06:52:27 | 24,005,062 | 15 | 2014-06-02 23:51:50 | 891,976 | 2014-06-02 23:51:50 | https://stackoverflow.com/q/24004300 | https://stackoverflow.com/a/24005062 | <p>Here is an example which keeps the decimal values and uses the full conversion value.</p>
<p><strong>Code</strong></p>
<pre><code>@echo off
for /f "skip=1 tokens=2 delims==" %%A in ('wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature /value') do set /a "HunDegCel=(%%~A*10)-27315"
... | <p>Here is an example which keeps the decimal values and uses the full conversion value.</p> <p><strong>Code</strong></p> <pre><code>@echo off for /f "skip=1 tokens=2 delims==" %%A in ('wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature /value') do set /a "HunDegCel=(%%~A*10)-27315" ... | 64, 448, 7002, 15691, 34595 | batch-file, cpu, temp, windows, windows-7 | <h1>Batch-file get CPU temperature in °C and set as variable</h1>
<p>How do i get a batch-file to work out the temperature of the Cpu and return it as a variable. I know it can be done as i have seen it been done. The solution can use any external tool. I have looked on Google for at least 2 hours but found nothing. Ca... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,223 | cmd | # Batch-file get CPU temperature in °C and set as variable
How do i get a batch-file to work out the temperature of the Cpu and return it as a variable. I know it can be done as i have seen it been done. The solution can use any external tool. I have looked on Google for at least 2 hours but found nothing. Can any one... | Here is an example which keeps the decimal values and uses the full conversion value.
**Code**
```
@echo off
for /f "skip=1 tokens=2 delims==" %%A in ('wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature /value') do set /a "HunDegCel=(%%~A*10)-27315"
echo %HunDegCel:~0,-2%.%HunDegCel:... |
14277566 | How can one batch file get the exit code of another? | 12 | 2013-01-11 11:47:31 | <p>I have two batch files, <code>task.bat</code> and <code>runtask.bat</code>. The <code>runtask.bat</code>calls <code>task.bat</code>and I would like <code>runtask.bat</code> to get the exit code of <code>task.bat</code> into a variable. How could this be done?</p>
<p><strong>task.bat:</strong></p>
<pre><code>@echo ... | 13,380 | 410,072 | 2024-08-12 12:55:58 | 14,279,052 | 15 | 2013-01-11 13:19:14 | 799,586 | 2013-01-11 13:19:14 | https://stackoverflow.com/q/14277566 | https://stackoverflow.com/a/14279052 | <p>Just swap <code>CMD /C</code> for <code>call</code>.</p>
<p><em><strong>task.bat:</em></strong></p>
<pre><code>@echo off
set errorlevel=15
</code></pre>
<p><em><strong>runtask.bat</em></strong></p>
<pre><code>call task.bat
set taskexitcode=%errorlevel%
echo %taskexitcode%
</code></pre>
<p><em><strong>Output</em... | <p>Just swap <code>CMD /C</code> for <code>call</code>.</p> <p><em><strong>task.bat:</em></strong></p> <pre><code>@echo off set errorlevel=15 </code></pre> <p><em><strong>runtask.bat</em></strong></p> <pre><code>call task.bat set taskexitcode=%errorlevel% echo %taskexitcode% </code></pre> <p><em><strong>Output</em... | 2216, 7002 | batch-file, windows-xp | <h1>How can one batch file get the exit code of another?</h1>
<p>I have two batch files, <code>task.bat</code> and <code>runtask.bat</code>. The <code>runtask.bat</code>calls <code>task.bat</code>and I would like <code>runtask.bat</code> to get the exit code of <code>task.bat</code> into a variable. How could this be d... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,224 | cmd | # How can one batch file get the exit code of another?
I have two batch files, `task.bat` and `runtask.bat`. The `runtask.bat`calls `task.bat`and I would like `runtask.bat` to get the exit code of `task.bat` into a variable. How could this be done?
**task.bat:**
```
@echo off
set errorlevel=1
```
**runtask.bat**
`... | Just swap `CMD /C` for `call`.
***task.bat:***
```
@echo off
set errorlevel=15
```
***runtask.bat***
```
call task.bat
set taskexitcode=%errorlevel%
echo %taskexitcode%
```
***Output***
```
15
``` |
12861410 | How to see full exception stack trace when running java app from console? | 12 | 2012-10-12 14:38:57 | <p>While running java app from console i got an exception, that contains following line:</p>
<blockquote>
<p>... 5 more</p>
</blockquote>
<p>Is it possible to see a full trace? Is there any cmd argument?</p>
<p>Thanks.</p>
| 6,207 | 1,322,076 | 2012-10-12 14:41:35 | 12,861,471 | 15 | 2012-10-12 14:41:35 | 57,695 | 2012-10-12 14:41:35 | https://stackoverflow.com/q/12861410 | https://stackoverflow.com/a/12861471 | <p>The full trace is there, but it is a repeat of the nested exception above which is why it is summarised.</p>
<pre><code>public class Main {
public static void throwsException() {
throw new UnsupportedOperationException();
}
public static void main(String... args) throws NoSuchMethodException, I... | <p>The full trace is there, but it is a repeat of the nested exception above which is why it is summarised.</p> <pre><code>public class Main { public static void throwsException() { throw new UnsupportedOperationException(); } public static void main(String... args) throws NoSuchMethodException, I... | 17, 277, 2631 | cmd, debugging, java | <h1>How to see full exception stack trace when running java app from console?</h1>
<p>While running java app from console i got an exception, that contains following line:</p>
<blockquote>
<p>... 5 more</p>
</blockquote>
<p>Is it possible to see a full trace? Is there any cmd argument?</p>
<p>Thanks.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,226 | cmd | # How to see full exception stack trace when running java app from console?
While running java app from console i got an exception, that contains following line:
> ... 5 more
Is it possible to see a full trace? Is there any cmd argument?
Thanks. | The full trace is there, but it is a repeat of the nested exception above which is why it is summarised.
```
public class Main {
public static void throwsException() {
throw new UnsupportedOperationException();
}
public static void main(String... args) throws NoSuchMethodException, InvocationTarge... |
11668026 | Get path to executable from command (as cmd does) | 12 | 2012-07-26 11:12:41 | <p>Given a command-line style path to a command such as <code>bin/server.exe</code> or <code>ping</code>, how can I get the full path to this executable (as cmd or <code>Process.Start</code> would resolve it)?</p>
<p>I tried <code>Path.GetFullPath</code>, but it always expands relative to the working directory. It exp... | 11,226 | 284,795 | 2017-01-10 21:23:10 | 11,672,569 | 15 | 2012-07-26 15:20:22 | 243,245 | 2017-01-10 21:23:10 | https://stackoverflow.com/q/11668026 | https://stackoverflow.com/a/11672569 | <p>Considering PATHEXT too, stealing from Serj-Tm's answer (sorry! +1 to him):</p>
<pre><code>public static string WhereSearch(string filename)
{
var paths = new[]{ Environment.CurrentDirectory }
.Concat(Environment.GetEnvironmentVariable("PATH").Split(';'));
var extensions = new[]{ String.Empty }
... | <p>Considering PATHEXT too, stealing from Serj-Tm's answer (sorry! +1 to him):</p> <pre><code>public static string WhereSearch(string filename) { var paths = new[]{ Environment.CurrentDirectory } .Concat(Environment.GetEnvironmentVariable("PATH").Split(';')); var extensions = new[]{ String.Empty } ... | 1, 9, 2631, 6268, 9938 | .net, c#, cmd, command-prompt, path | <h1>Get path to executable from command (as cmd does)</h1>
<p>Given a command-line style path to a command such as <code>bin/server.exe</code> or <code>ping</code>, how can I get the full path to this executable (as cmd or <code>Process.Start</code> would resolve it)?</p>
<p>I tried <code>Path.GetFullPath</code>, but ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,227 | cmd | # Get path to executable from command (as cmd does)
Given a command-line style path to a command such as `bin/server.exe` or `ping`, how can I get the full path to this executable (as cmd or `Process.Start` would resolve it)?
I tried `Path.GetFullPath`, but it always expands relative to the working directory. It expa... | Considering PATHEXT too, stealing from Serj-Tm's answer (sorry! +1 to him):
```
public static string WhereSearch(string filename)
{
var paths = new[]{ Environment.CurrentDirectory }
.Concat(Environment.GetEnvironmentVariable("PATH").Split(';'));
var extensions = new[]{ String.Empty }
.C... |
6914374 | Visual Studio Build Event Immediately Return | 12 | 2011-08-02 15:17:48 | <p>I have a somewhat long-running post-build event (long enough to be annoying to wait for but short enough to be finished after each release compilation) that I want to return immediately to VS. I've tried to run batch files with <code>start</code> but visual studio still waits for the <code>cmd</code> window to clos... | 2,079 | 32,140 | 2024-08-04 21:18:03 | 6,914,558 | 15 | 2011-08-02 15:31:01 | 271,047 | 2011-08-02 15:31:01 | https://stackoverflow.com/q/6914374 | https://stackoverflow.com/a/6914558 | <p><a href="https://stackoverflow.com/questions/1768358/how-to-create-an-asynchronous-build-event-in-visual-studio-2008">This</a> question seems to think that there is a way:</p>
<pre><code>powershell start-process <actual-command-line-to-run>
</code></pre>
<p>Haven't tested it myself though.</p>
| <p><a href="https://stackoverflow.com/questions/1768358/how-to-create-an-asynchronous-build-event-in-visual-studio-2008">This</a> question seems to think that there is a way:</p> <pre><code>powershell start-process <actual-command-line-to-run> </code></pre> <p>Haven't tested it myself though.</p> | 7002, 33953 | batch-file, visual-studio | <h1>Visual Studio Build Event Immediately Return</h1>
<p>I have a somewhat long-running post-build event (long enough to be annoying to wait for but short enough to be finished after each release compilation) that I want to return immediately to VS. I've tried to run batch files with <code>start</code> but visual stud... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,228 | cmd | # Visual Studio Build Event Immediately Return
I have a somewhat long-running post-build event (long enough to be annoying to wait for but short enough to be finished after each release compilation) that I want to return immediately to VS. I've tried to run batch files with `start` but visual studio still waits for th... | [This](https://stackoverflow.com/questions/1768358/how-to-create-an-asynchronous-build-event-in-visual-studio-2008) question seems to think that there is a way:
```
powershell start-process <actual-command-line-to-run>
```
Haven't tested it myself though. |
2620210 | Batch file to map a drive when the folder name contains spaces | 12 | 2010-04-12 06:22:23 | <p>I am trying to map a drive using a batch file.
I have tried:</p>
<pre><code>net use m: \\Server01\myfolder /USER:mynetwork\Administrator "Mypassword" /persistent:yes
</code></pre>
<p>It works fine. The problem comes when I try to map a folder with spaces on its name:</p>
<pre><code>net use m: \\Server01\my folder... | 107,460 | 314,260 | 2015-04-13 16:42:49 | 2,620,316 | 15 | 2010-04-12 06:47:48 | 184,953 | 2010-04-12 06:47:48 | https://stackoverflow.com/q/2620210 | https://stackoverflow.com/a/2620316 | <p>I just created some directories, shared them and mapped using:</p>
<pre><code>net use y: "\\mycomputername\folder with spaces"
</code></pre>
<p>So this solution gets "works on my machine" certificate. What error code do you get?</p>
| <p>I just created some directories, shared them and mapped using:</p> <pre><code>net use y: "\\mycomputername\folder with spaces" </code></pre> <p>So this solution gets "works on my machine" certificate. What error code do you get?</p> | 7002 | batch-file | <h1>Batch file to map a drive when the folder name contains spaces</h1>
<p>I am trying to map a drive using a batch file.
I have tried:</p>
<pre><code>net use m: \\Server01\myfolder /USER:mynetwork\Administrator "Mypassword" /persistent:yes
</code></pre>
<p>It works fine. The problem comes when I try to map a folder ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,229 | cmd | # Batch file to map a drive when the folder name contains spaces
I am trying to map a drive using a batch file.
I have tried:
```
net use m: \\Server01\myfolder /USER:mynetwork\Administrator "Mypassword" /persistent:yes
```
It works fine. The problem comes when I try to map a folder with spaces on its name:
```
net... | I just created some directories, shared them and mapped using:
```
net use y: "\\mycomputername\folder with spaces"
```
So this solution gets "works on my machine" certificate. What error code do you get? |
58404831 | How to get Subnet list from VPC with terraform | 11 | 2019-10-16 02:13:46 | <p>I've tried to get all subnet ids to add aws batch with terraform with following code:</p>
<pre><code>data "aws_subnet_ids" "test_subnet_ids" {
vpc_id = "default"
}
data "aws_subnet" "test_subnet" {
count = "${length(data.aws_subnet_ids.test_subnet_ids.ids)}"
id = "${tolist(data.aws_subnet_ids.test_subnet_i... | 44,804 | 2,555,911 | 2021-04-30 13:21:34 | 58,405,816 | 15 | 2019-10-16 04:34:16 | 12,200,437 | 2019-10-16 04:34:16 | https://stackoverflow.com/q/58404831 | https://stackoverflow.com/a/58405816 | <p><code>"${data.aws_subnet.test_subnet.*.id}"</code> is already <code>string array</code> type.</p>
<p>you should input value without <code>[ ]</code></p>
<p>write code like :</p>
<pre class="lang-sh prettyprint-override"><code>subnets = "${data.aws_subnet.test_subnet.*.id}"
</code></pre>
<blockquote>
<p>See :</... | <p><code>"${data.aws_subnet.test_subnet.*.id}"</code> is already <code>string array</code> type.</p> <p>you should input value without <code>[ ]</code></p> <p>write code like :</p> <pre class="lang-sh prettyprint-override"><code>subnets = "${data.aws_subnet.test_subnet.*.id}" </code></pre> <blockquote> <p>See :</... | 110634, 124227, 131331 | aws-batch, terraform, terraform-provider-aws | <h1>How to get Subnet list from VPC with terraform</h1>
<p>I've tried to get all subnet ids to add aws batch with terraform with following code:</p>
<pre><code>data "aws_subnet_ids" "test_subnet_ids" {
vpc_id = "default"
}
data "aws_subnet" "test_subnet" {
count = "${length(data.aws_subnet_ids.test_subnet_ids.ids)... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,230 | cmd | # How to get Subnet list from VPC with terraform
I've tried to get all subnet ids to add aws batch with terraform with following code:
```
data "aws_subnet_ids" "test_subnet_ids" {
vpc_id = "default"
}
data "aws_subnet" "test_subnet" {
count = "${length(data.aws_subnet_ids.test_subnet_ids.ids)}"
id = "${toli... | `"${data.aws_subnet.test_subnet.*.id}"` is already `string array` type.
you should input value without `[ ]`
write code like :
```
subnets = "${data.aws_subnet.test_subnet.*.id}"
```
> See :
>
> Here's [A document](https://www.terraform.io/docs/providers/aws/r/batch_compute_environment.html) about `Resource: aws_ba... |
24866477 | IF, CALL, EXIT and %ERRORLEVEL% in a .bat | 11 | 2014-07-21 13:36:41 | <p>Can anyone please help me understand the behaviour of <code>%ERRORLEVEL%</code> variable and why it's not being set after a <code>CALL</code> while being inside an <code>IF</code>, i.e. the <strong><code>ECHO %ERRORLEVEL%.2</code></strong> line?</p>
<pre><code>@ECHO OFF
SET ERRORLEVEL
VERIFY > NUL
ECHO %ERRORLE... | 23,110 | 384,478 | 2014-07-21 13:57:35 | 24,866,713 | 15 | 2014-07-21 13:47:45 | 2,861,476 | 2014-07-21 13:47:45 | https://stackoverflow.com/q/24866477 | https://stackoverflow.com/a/24866713 | <p>When the cmd parser reads a line or a block of lines (the code inside the parenthesis), all variable reads are replaced with the value inside the variable <strong>before</strong> starting to execute the code. If the execution of the code in the block changes the value of the variable, this value can not be seen from... | <p>When the cmd parser reads a line or a block of lines (the code inside the parenthesis), all variable reads are replaced with the value inside the variable <strong>before</strong> starting to execute the code. If the execution of the code in the block changes the value of the variable, this value can not be seen from... | 64, 7002 | batch-file, windows | <h1>IF, CALL, EXIT and %ERRORLEVEL% in a .bat</h1>
<p>Can anyone please help me understand the behaviour of <code>%ERRORLEVEL%</code> variable and why it's not being set after a <code>CALL</code> while being inside an <code>IF</code>, i.e. the <strong><code>ECHO %ERRORLEVEL%.2</code></strong> line?</p>
<pre><code>@ECH... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,231 | cmd | # IF, CALL, EXIT and %ERRORLEVEL% in a .bat
Can anyone please help me understand the behaviour of `%ERRORLEVEL%` variable and why it's not being set after a `CALL` while being inside an `IF`, i.e. the **`ECHO %ERRORLEVEL%.2`** line?
```
@ECHO OFF
SET ERRORLEVEL
VERIFY > NUL
ECHO %ERRORLEVEL%.0
IF ERRORLEVEL 1 ECHO S... | When the cmd parser reads a line or a block of lines (the code inside the parenthesis), all variable reads are replaced with the value inside the variable **before** starting to execute the code. If the execution of the code in the block changes the value of the variable, this value can not be seen from inside the same... |
11225683 | Writing Numbers to a text file - batch file | 11 | 2012-06-27 11:59:15 | <p>This should be a simple one and I am dissapointed with myself but cant for the life of me find a solution! I am trying to write the number 1 to a text file in a BAT script. If I do the below it works but leaves a trailing space after the number which I cannot have. I know you can remove the trailing space by deletin... | 6,511 | 571,611 | 2014-09-08 08:41:17 | 11,226,556 | 15 | 2012-06-27 12:46:26 | 463,115 | 2012-06-27 12:46:26 | https://stackoverflow.com/q/11225683 | https://stackoverflow.com/a/11226556 | <p>The problem is that <code>echo 1> myTextFile.txt</code> will not echo <code>1</code>, instead the echo command is empty and the redirection goes to stream 1. </p>
<p>You could simply move the redirection to the front.</p>
<pre><code>>mytextfile.txt echo 1
</code></pre>
| <p>The problem is that <code>echo 1> myTextFile.txt</code> will not echo <code>1</code>, instead the echo command is empty and the redirection goes to stream 1. </p> <p>You could simply move the redirection to the front.</p> <pre><code>>mytextfile.txt echo 1 </code></pre> | 64, 7002 | batch-file, windows | <h1>Writing Numbers to a text file - batch file</h1>
<p>This should be a simple one and I am dissapointed with myself but cant for the life of me find a solution! I am trying to write the number 1 to a text file in a BAT script. If I do the below it works but leaves a trailing space after the number which I cannot have... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,232 | cmd | # Writing Numbers to a text file - batch file
This should be a simple one and I am dissapointed with myself but cant for the life of me find a solution! I am trying to write the number 1 to a text file in a BAT script. If I do the below it works but leaves a trailing space after the number which I cannot have. I know ... | The problem is that `echo 1> myTextFile.txt` will not echo `1`, instead the echo command is empty and the redirection goes to stream 1.
You could simply move the redirection to the front.
```
>mytextfile.txt echo 1
``` |
54430418 | Get latest job revision while submitting AWS batch job without specifying the exact revision number | 10 | 2019-01-29 22:12:54 | <p>I am using AWSBatch Java client <code>com.amazonaws.services.batch (AWS SDK for Java - 1.11.483)</code> to submit jobs programmatically.</p>
<p>However, our scientists keep updating the job definition.
Every time there is a new job definition, I have to update the environment variable with the revision number to pa... | 5,876 | 10,729,870 | 2020-09-25 09:09:01 | 55,031,183 | 15 | 2019-03-06 19:52:49 | 5,898,737 | 2019-03-06 19:52:49 | https://stackoverflow.com/q/54430418 | https://stackoverflow.com/a/55031183 | <blockquote>
<p>This value can be either a name:revision or the Amazon Resource Name (ARN) for the job definition.</p>
</blockquote>
<p>Seems like AWS didn't document this properly: <code>revision</code> is optional, you can use simply use <code>name</code> instead of <code>name:revision</code> and it will get the <... | <blockquote> <p>This value can be either a name:revision or the Amazon Resource Name (ARN) for the job definition.</p> </blockquote> <p>Seems like AWS didn't document this properly: <code>revision</code> is optional, you can use simply use <code>name</code> instead of <code>name:revision</code> and it will get the <... | 33388, 107211, 124227 | amazon-web-services, aws-batch, aws-sdk | <h1>Get latest job revision while submitting AWS batch job without specifying the exact revision number</h1>
<p>I am using AWSBatch Java client <code>com.amazonaws.services.batch (AWS SDK for Java - 1.11.483)</code> to submit jobs programmatically.</p>
<p>However, our scientists keep updating the job definition.
Every... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,233 | cmd | # Get latest job revision while submitting AWS batch job without specifying the exact revision number
I am using AWSBatch Java client `com.amazonaws.services.batch (AWS SDK for Java - 1.11.483)` to submit jobs programmatically.
However, our scientists keep updating the job definition.
Every time there is a new job de... | > This value can be either a name:revision or the Amazon Resource Name (ARN) for the job definition.
Seems like AWS didn't document this properly: `revision` is optional, you can use simply use `name` instead of `name:revision` and it will get the `ACTIVE` revision of your job definition. It's also optional for Job De... |
27589925 | Simple batch for checking internet connectivity and setting environment variable %internet% depending on result | 10 | 2014-12-21 13:43:44 | <p>I want to check internet connection, when it fails I want to set <code>%internet%</code> to not connected. And if it works to <code>connected</code>.</p>
<pre><code>echo checking internet connection
Ping www.google.nl -n 1 -w 1000
cls
if errorlevel 1 (set internet=Not connected to internet)
if errorlevel 0 (set int... | 36,344 | 2,991,298 | 2024-11-27 00:39:23 | 27,590,444 | 15 | 2014-12-21 14:47:19 | 2,128,947 | 2014-12-21 14:47:19 | https://stackoverflow.com/q/27589925 | https://stackoverflow.com/a/27590444 | <p>With a tweak, your original code will work.</p>
<pre class="lang-dos prettyprint-override"><code>echo checking internet connection
Ping www.google.nl -n 1 -w 1000
cls
if errorlevel 1 (set internet=Not connected to internet) else (set internet=Connected to internet)
echo %internet%
</code></pre>
<p>The issue is th... | <p>With a tweak, your original code will work.</p> <pre class="lang-dos prettyprint-override"><code>echo checking internet connection Ping www.google.nl -n 1 -w 1000 cls if errorlevel 1 (set internet=Not connected to internet) else (set internet=Connected to internet) echo %internet% </code></pre> <p>The issue is th... | 5310, 5649, 7002 | batch-file, file, ping | <h1>Simple batch for checking internet connectivity and setting environment variable %internet% depending on result</h1>
<p>I want to check internet connection, when it fails I want to set <code>%internet%</code> to not connected. And if it works to <code>connected</code>.</p>
<pre><code>echo checking internet connect... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,234 | cmd | # Simple batch for checking internet connectivity and setting environment variable %internet% depending on result
I want to check internet connection, when it fails I want to set `%internet%` to not connected. And if it works to `connected`.
```
echo checking internet connection
Ping www.google.nl -n 1 -w 1000
cls
if... | With a tweak, your original code will work.
```
echo checking internet connection
Ping www.google.nl -n 1 -w 1000
cls
if errorlevel 1 (set internet=Not connected to internet) else (set internet=Connected to internet)
echo %internet%
```
The issue is that `IF ERRORLEVEL n` is TRUE if `errorlevel` is n **or greater th... |
22307698 | Reading a specific line in a text file to a variable in a batch file | 10 | 2014-03-10 17:54:56 | <p>In one of my batch files I'm attempting to write, I need to read the last line in a 5 line text file into a variable. One way I thought of doing this might be to have each line that is put into the text file overwrite the previous (as the files creation and lines are all created by a command, specifically slmgr /xpr... | 53,378 | 2,997,654 | 2025-12-27 20:11:51 | 22,309,628 | 15 | 2014-03-10 19:36:25 | 2,128,947 | 2014-03-10 19:36:25 | https://stackoverflow.com/q/22307698 | https://stackoverflow.com/a/22309628 | <p>if you want specifically line 5:</p>
<pre><code>set "xprvar="
for /F "skip=4 delims=" %%i in (xprtest.txt) do if not defined xprvar set "xprvar=%%i"
</code></pre>
<p>OR</p>
<pre><code>for /F "skip=4 delims=" %%i in (xprtest.txt) do set "xprvar=%%i"&goto nextline
:nextline
</code></pre>
<p>if you want the las... | <p>if you want specifically line 5:</p> <pre><code>set "xprvar=" for /F "skip=4 delims=" %%i in (xprtest.txt) do if not defined xprvar set "xprvar=%%i" </code></pre> <p>OR</p> <pre><code>for /F "skip=4 delims=" %%i in (xprtest.txt) do set "xprvar=%%i"&goto nextline :nextline </code></pre> <p>if you want the las... | 1469, 2908, 7002 | activation, batch-file, text | <h1>Reading a specific line in a text file to a variable in a batch file</h1>
<p>In one of my batch files I'm attempting to write, I need to read the last line in a 5 line text file into a variable. One way I thought of doing this might be to have each line that is put into the text file overwrite the previous (as the ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,235 | cmd | # Reading a specific line in a text file to a variable in a batch file
In one of my batch files I'm attempting to write, I need to read the last line in a 5 line text file into a variable. One way I thought of doing this might be to have each line that is put into the text file overwrite the previous (as the files cre... | if you want specifically line 5:
```
set "xprvar="
for /F "skip=4 delims=" %%i in (xprtest.txt) do if not defined xprvar set "xprvar=%%i"
```
OR
```
for /F "skip=4 delims=" %%i in (xprtest.txt) do set "xprvar=%%i"&goto nextline
:nextline
```
if you want the last line regardless of the number of lines:
```
for /F "... |
20219527 | Batch file set wmi output as a variable | 10 | 2013-11-26 14:16:48 | <p>Hello having my first go with a BATCH script, I'm getting the size of the HDD as follow:</p>
<pre><code>wmic diskdrive get size
</code></pre>
<p>Which works fine but I'd like to store this value into a variable for later use, such as using ECHO to display the value.</p>
<p>I'm not sure how I set the output of the... | 49,374 | 1,005,169 | 2020-05-27 01:04:22 | 20,219,840 | 15 | 2013-11-26 14:30:10 | 2,861,476 | 2013-11-26 14:30:10 | https://stackoverflow.com/q/20219527 | https://stackoverflow.com/a/20219840 | <p>For usage in batch file. From command line, replace %% with %</p>
<pre><code>for /f "tokens=*" %%f in ('wmic diskdrive get size /value ^| find "="') do set "%%f"
echo %size%
</code></pre>
<p>Or, if you want to use you prefered variable</p>
<pre><code>for /f "tokens=2 delims==" %%f in ('wmic diskdrive get size /va... | <p>For usage in batch file. From command line, replace %% with %</p> <pre><code>for /f "tokens=*" %%f in ('wmic diskdrive get size /value ^| find "="') do set "%%f" echo %size% </code></pre> <p>Or, if you want to use you prefered variable</p> <pre><code>for /f "tokens=2 delims==" %%f in ('wmic diskdrive get size /va... | 64, 7002 | batch-file, windows | <h1>Batch file set wmi output as a variable</h1>
<p>Hello having my first go with a BATCH script, I'm getting the size of the HDD as follow:</p>
<pre><code>wmic diskdrive get size
</code></pre>
<p>Which works fine but I'd like to store this value into a variable for later use, such as using ECHO to display the value.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,236 | cmd | # Batch file set wmi output as a variable
Hello having my first go with a BATCH script, I'm getting the size of the HDD as follow:
```
wmic diskdrive get size
```
Which works fine but I'd like to store this value into a variable for later use, such as using ECHO to display the value.
I'm not sure how I set the outp... | For usage in batch file. From command line, replace %% with %
```
for /f "tokens=*" %%f in ('wmic diskdrive get size /value ^| find "="') do set "%%f"
echo %size%
```
Or, if you want to use you prefered variable
```
for /f "tokens=2 delims==" %%f in ('wmic diskdrive get size /value ^| find "="') do set "myVar=%%f"
e... |
4499117 | how to start stop tomcat server using CMD? | 10 | 2010-12-21 12:14:45 | <p>I set the path for the tomcat and set all variables like</p>
<ol>
<li><code>JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_22</code></li>
<li><code>CATALINA_HOME=G:\springwork\server\apache-tomcat-6.0.29</code></li>
<li><code>CLASSPATH=G:\springwork\server\apache-tomcat-6.0.29\lib\servlet-api.jar;G:\springwork\serv... | 200,404 | null | 2023-08-03 14:38:57 | 4,499,142 | 15 | 2010-12-21 12:17:55 | 114,251 | 2010-12-30 05:48:26 | https://stackoverflow.com/q/4499117 | https://stackoverflow.com/a/4499142 | <p>Add <code>%CATALINA_HOME%/bin</code> to path system variable.</p>
<p>Go to <code>Environment Variables</code> screen under <code>System Variables</code> there will be a <code>Path</code> variable edit the variable and add <code>;%CATALINA_HOME%\bin</code> to the variable then click <code>OK</code> to save the chang... | <p>Add <code>%CATALINA_HOME%/bin</code> to path system variable.</p> <p>Go to <code>Environment Variables</code> screen under <code>System Variables</code> there will be a <code>Path</code> variable edit the variable and add <code>;%CATALINA_HOME%\bin</code> to the variable then click <code>OK</code> to save the chang... | 17, 80, 1603, 7002, 9013 | apache, batch-file, environment-variables, java, tomcat | <h1>how to start stop tomcat server using CMD?</h1>
<p>I set the path for the tomcat and set all variables like</p>
<ol>
<li><code>JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_22</code></li>
<li><code>CATALINA_HOME=G:\springwork\server\apache-tomcat-6.0.29</code></li>
<li><code>CLASSPATH=G:\springwork\server\apache-... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,238 | cmd | # how to start stop tomcat server using CMD?
I set the path for the tomcat and set all variables like
1. `JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_22`
2. `CATALINA_HOME=G:\springwork\server\apache-tomcat-6.0.29`
3. `CLASSPATH=G:\springwork\server\apache-tomcat-6.0.29\lib\servlet-api.jar;G:\springwork\server\apa... | Add `%CATALINA_HOME%/bin` to path system variable.
Go to `Environment Variables` screen under `System Variables` there will be a `Path` variable edit the variable and add `;%CATALINA_HOME%\bin` to the variable then click `OK` to save the changes. Close all opened command prompts then open a new command prompt and try ... |
831122 | Set variable to result of "Find" in batch-file | 10 | 2009-05-06 18:51:23 | <p>I would like to set a variable based on the number of lines in a file that contain a give string.</p>
<p>Something like:</p>
<pre><code>set isComplete = 0
%isComplete% = find /c /i "Transfer Complete" "C:\ftp.LOG"
IF %isComplete% > 0 ECHO "Success" ELSE ECHO "Failure"
</code></pre>
<p>Or:</p>
<pre><code>set i... | 70,700 | 81 | 2016-03-10 15:22:19 | 831,180 | 15 | 2009-05-06 19:03:31 | 30,225 | 2009-05-06 19:03:31 | https://stackoverflow.com/q/831122 | https://stackoverflow.com/a/831180 | <p>from the command line</p>
<pre><code>for /f "tokens=3" %f in ('find /c /i "Transfer Complete" "C:\ftp.LOG"') do set isComplete=%f
</code></pre>
<p>from the batch script</p>
<pre><code>for /f "tokens=3" %%f in ('find /c /i "Transfer Complete" "C:\ftp.LOG"') do set isComplete=%%f
</code></pre>
| <p>from the command line</p> <pre><code>for /f "tokens=3" %f in ('find /c /i "Transfer Complete" "C:\ftp.LOG"') do set isComplete=%f </code></pre> <p>from the batch script</p> <pre><code>for /f "tokens=3" %%f in ('find /c /i "Transfer Complete" "C:\ftp.LOG"') do set isComplete=%%f </code></pre> | 7002, 10193 | batch-file, find | <h1>Set variable to result of "Find" in batch-file</h1>
<p>I would like to set a variable based on the number of lines in a file that contain a give string.</p>
<p>Something like:</p>
<pre><code>set isComplete = 0
%isComplete% = find /c /i "Transfer Complete" "C:\ftp.LOG"
IF %isComplete% > 0 ECHO "Success" ELSE EC... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,239 | cmd | # Set variable to result of "Find" in batch-file
I would like to set a variable based on the number of lines in a file that contain a give string.
Something like:
```
set isComplete = 0
%isComplete% = find /c /i "Transfer Complete" "C:\ftp.LOG"
IF %isComplete% > 0 ECHO "Success" ELSE ECHO "Failure"
```
Or:
```
set... | from the command line
```
for /f "tokens=3" %f in ('find /c /i "Transfer Complete" "C:\ftp.LOG"') do set isComplete=%f
```
from the batch script
```
for /f "tokens=3" %%f in ('find /c /i "Transfer Complete" "C:\ftp.LOG"') do set isComplete=%%f
``` |
43314517 | How to install multiple whl files in cmd | 9 | 2017-04-10 03:23:17 | <p>I know how to install <code>*.whl</code> files through cmd (the code is simply <code>python -m pip install *so-and-so-.whl</code>). But since I accidentally deleted my OS and had no backups I found myself in the predicament to reinstall all of my whl files for my work. </p>
<p>This comes up to around 50 files. I ca... | 22,183 | 4,806,266 | 2018-10-31 09:34:21 | 43,314,623 | 15 | 2017-04-10 03:39:22 | 7,311,767 | 2017-04-10 03:39:22 | https://stackoverflow.com/q/43314517 | https://stackoverflow.com/a/43314623 | <p>In Windows <code>cmd</code> you can use a for loop to do this:</p>
<pre><code>for %x in (dir *.whl) do python -m pip install %x
</code></pre>
| <p>In Windows <code>cmd</code> you can use a for loop to do this:</p> <pre><code>for %x in (dir *.whl) do python -m pip install %x </code></pre> | 16, 2631 | cmd, python | <h1>How to install multiple whl files in cmd</h1>
<p>I know how to install <code>*.whl</code> files through cmd (the code is simply <code>python -m pip install *so-and-so-.whl</code>). But since I accidentally deleted my OS and had no backups I found myself in the predicament to reinstall all of my whl files for my wor... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,240 | cmd | # How to install multiple whl files in cmd
I know how to install `*.whl` files through cmd (the code is simply `python -m pip install *so-and-so-.whl`). But since I accidentally deleted my OS and had no backups I found myself in the predicament to reinstall all of my whl files for my work.
This comes up to around 50 ... | In Windows `cmd` you can use a for loop to do this:
```
for %x in (dir *.whl) do python -m pip install %x
``` |
40950799 | R CMD check error : how to get rid of hidden files and directory in devel R package on windows? | 9 | 2016-12-03 17:57:20 | <p>I am building my R package on Rstudio, and I am running R CMD check for my packages. However, R CMD check warn few issues that possibly result in error. I checked my project home directory, indeed some files was hidden, now I set them up visible. Just out of curiosity, how to stop exist <code>.gitignore, .Rproj.user... | 3,874 | 6,729,272 | 2016-12-04 13:00:10 | 40,950,862 | 15 | 2016-12-03 18:04:59 | 143,305 | 2016-12-03 18:11:40 | https://stackoverflow.com/q/40950799 | https://stackoverflow.com/a/40950862 | <p>You are (likely) doing it wrong. Do the following:</p>
<pre><code>cd ..
R CMD build yourDirectory/
R CMD check yourPackage_0.1.0.tar.gz
</code></pre>
<p>as the <em>creation</em> of the source tarball will <em>automatically exclude</em> the internal directories you want skipped. Which is why checking against tarb... | <p>You are (likely) doing it wrong. Do the following:</p> <pre><code>cd .. R CMD build yourDirectory/ R CMD check yourPackage_0.1.0.tar.gz </code></pre> <p>as the <em>creation</em> of the source tarball will <em>automatically exclude</em> the internal directories you want skipped. Which is why checking against tarb... | 64, 2631, 4452, 67746 | cmd, r, rstudio, windows | <h1>R CMD check error : how to get rid of hidden files and directory in devel R package on windows?</h1>
<p>I am building my R package on Rstudio, and I am running R CMD check for my packages. However, R CMD check warn few issues that possibly result in error. I checked my project home directory, indeed some files was ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,241 | cmd | # R CMD check error : how to get rid of hidden files and directory in devel R package on windows?
I am building my R package on Rstudio, and I am running R CMD check for my packages. However, R CMD check warn few issues that possibly result in error. I checked my project home directory, indeed some files was hidden, n... | You are (likely) doing it wrong. Do the following:
```
cd ..
R CMD build yourDirectory/
R CMD check yourPackage_0.1.0.tar.gz
```
as the *creation* of the source tarball will *automatically exclude* the internal directories you want skipped. Which is why checking against tarballs (rather than directories) is the *reco... |
39837335 | How come jobParameters cannot be found in ItemProcessor using annotations? | 9 | 2016-10-03 17:39:17 | <p>I am having issues using the job parameters in my item processor. At this time, the code is basically setup like: <a href="https://stackoverflow.com/questions/31737209/how-to-get-job-parameteres-in-to-item-processor-using-spring-batch-annotation">How to get Job parameteres in to item processor using spring Batch ann... | 21,231 | 6,106,766 | 2016-10-03 17:59:56 | 39,837,668 | 15 | 2016-10-03 17:59:56 | 618,059 | 2016-10-03 17:59:56 | https://stackoverflow.com/q/39837335 | https://stackoverflow.com/a/39837668 | <p>The <code>@Scope("step")</code> should be on the bean definition (in the <code>ClaimBatchConfiguration</code>), not on the class itself. Also, as an FYI, you can use <code>@StepScope</code> as a short cut (also on the bean definition).</p>
| <p>The <code>@Scope("step")</code> should be on the bean definition (in the <code>ClaimBatchConfiguration</code>), not on the class itself. Also, as an FYI, you can use <code>@StepScope</code> as a short cut (also on the bean definition).</p> | 1211, 16537, 41895 | spring, spring-batch, spring-integration | <h1>How come jobParameters cannot be found in ItemProcessor using annotations?</h1>
<p>I am having issues using the job parameters in my item processor. At this time, the code is basically setup like: <a href="https://stackoverflow.com/questions/31737209/how-to-get-job-parameteres-in-to-item-processor-using-spring-batc... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,242 | cmd | # How come jobParameters cannot be found in ItemProcessor using annotations?
I am having issues using the job parameters in my item processor. At this time, the code is basically setup like: [How to get Job parameteres in to item processor using spring Batch annotation](https://stackoverflow.com/questions/31737209/how... | The `@Scope("step")` should be on the bean definition (in the `ClaimBatchConfiguration`), not on the class itself. Also, as an FYI, you can use `@StepScope` as a short cut (also on the bean definition). |
26203345 | Add multiple SSH keys using ansible | 9 | 2014-10-05 14:09:56 | <p>I have written an ansible script to remove SSH keys from remote servers:</p>
<pre class="lang-yaml prettyprint-override"><code>---
- name: "Add keys to the authorized_keys of the user ubuntu"
user: ubuntu
hosts: www
tasks:
- name: "Remove key #1"
authorized_key: user=ubuntu key="{{ item }}" state=absent... | 9,502 | 51,197 | 2015-06-30 12:31:43 | 26,207,120 | 15 | 2014-10-05 20:56:03 | 601,704 | 2014-10-05 20:56:03 | https://stackoverflow.com/q/26203345 | https://stackoverflow.com/a/26207120 | <p>I believe you are only getting the filenames using <code>with_fileglob</code>, but <code>with_file</code> retrieves the <em>contents</em> of the file. And the authorized_key module requires the actual key.</p>
<p>So you should still loop by using <code>with_fileglob</code>, but instead of sending the filename to th... | <p>I believe you are only getting the filenames using <code>with_fileglob</code>, but <code>with_file</code> retrieves the <em>contents</em> of the file. And the authorized_key module requires the actual key.</p> <p>So you should still loop by using <code>with_fileglob</code>, but instead of sending the filename to th... | 386, 25308, 30645, 86394 | ansible, batch-processing, ssh, ssh-keys | <h1>Add multiple SSH keys using ansible</h1>
<p>I have written an ansible script to remove SSH keys from remote servers:</p>
<pre class="lang-yaml prettyprint-override"><code>---
- name: "Add keys to the authorized_keys of the user ubuntu"
user: ubuntu
hosts: www
tasks:
- name: "Remove key #1"
authorized_k... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,243 | cmd | # Add multiple SSH keys using ansible
I have written an ansible script to remove SSH keys from remote servers:
```
---
- name: "Add keys to the authorized_keys of the user ubuntu"
user: ubuntu
hosts: www
tasks:
- name: "Remove key #1"
authorized_key: user=ubuntu key="{{ item }}" state=absent
with_file... | I believe you are only getting the filenames using `with_fileglob`, but `with_file` retrieves the *contents* of the file. And the authorized_key module requires the actual key.
So you should still loop by using `with_fileglob`, but instead of sending the filename to the "key=" parameter, you should use the [file looku... |
14701561 | batch scripting + ant - stop cmd prompt from auto exiting | 9 | 2013-02-05 06:36:49 | <p>i have an ant build.xml that does some building stuff. Before i execute this though, i need some variables/environment to be set. i am using <code>.bat</code> script to do that, and also trying to call <code>ant</code> directly from there, so that i dont have to do 2 steps.</p>
<p>Although the script calls the ant ... | 5,630 | 1,856,732 | 2013-02-05 08:48:11 | 14,703,331 | 15 | 2013-02-05 08:48:11 | 799,586 | 2013-02-05 08:48:11 | https://stackoverflow.com/q/14701561 | https://stackoverflow.com/a/14703331 | <p>If the ant script is a console app then you will need to <code>call</code> that also, otherwise control will be transferred to it and never return to the batch</p>
<pre><code>@echo off
call C:/somefile.bat
call ant targetName
pause
</code></pre>
| <p>If the ant script is a console app then you will need to <code>call</code> that also, otherwise control will be transferred to it and never return to the batch</p> <pre><code>@echo off call C:/somefile.bat call ant targetName pause </code></pre> | 142, 7002 | ant, batch-file | <h1>batch scripting + ant - stop cmd prompt from auto exiting</h1>
<p>i have an ant build.xml that does some building stuff. Before i execute this though, i need some variables/environment to be set. i am using <code>.bat</code> script to do that, and also trying to call <code>ant</code> directly from there, so that i ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,244 | cmd | # batch scripting + ant - stop cmd prompt from auto exiting
i have an ant build.xml that does some building stuff. Before i execute this though, i need some variables/environment to be set. i am using `.bat` script to do that, and also trying to call `ant` directly from there, so that i dont have to do 2 steps.
Altho... | If the ant script is a console app then you will need to `call` that also, otherwise control will be transferred to it and never return to the batch
```
@echo off
call C:/somefile.bat
call ant targetName
pause
``` |
14562362 | Breaking out of nested for loop in batch file | 9 | 2013-01-28 12:45:57 | <p>After coming across this issue twice I thought I would post it here to see if anyone knows how to get around it.</p>
<p>I can't seem to break out of nested loops using <code>goto</code>, because it looks like when it breaks out of the inner loop, the parentheses then don't match because it never reached the inner c... | 27,168 | 799,586 | 2021-08-04 20:14:32 | 14,563,555 | 15 | 2013-01-28 13:53:25 | 1,982,470 | 2013-01-28 13:53:25 | https://stackoverflow.com/q/14562362 | https://stackoverflow.com/a/14563555 | <p>Break by placing inner loop in a label. </p>
<pre><code>for %%a in (1, 2, 3) DO (
call :innerloop
)
:innerloop
for %%b in (4, 5, 6) DO (
if %%b==<something> (
echo break
goto :break
)
)
:break
</code></pre>
| <p>Break by placing inner loop in a label. </p> <pre><code>for %%a in (1, 2, 3) DO ( call :innerloop ) :innerloop for %%b in (4, 5, 6) DO ( if %%b==<something> ( echo break goto :break ) ) :break </code></pre> | 7002 | batch-file | <h1>Breaking out of nested for loop in batch file</h1>
<p>After coming across this issue twice I thought I would post it here to see if anyone knows how to get around it.</p>
<p>I can't seem to break out of nested loops using <code>goto</code>, because it looks like when it breaks out of the inner loop, the parenthese... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,245 | cmd | # Breaking out of nested for loop in batch file
After coming across this issue twice I thought I would post it here to see if anyone knows how to get around it.
I can't seem to break out of nested loops using `goto`, because it looks like when it breaks out of the inner loop, the parentheses then don't match because ... | Break by placing inner loop in a label.
```
for %%a in (1, 2, 3) DO (
call :innerloop
)
:innerloop
for %%b in (4, 5, 6) DO (
if %%b==<something> (
echo break
goto :break
)
)
:break
``` |
11645226 | Choose Highest Numbered File - Batch File | 9 | 2012-07-25 08:03:00 | <p>I have a directory full of .jar files, named progressively like so:</p>
<pre><code> version-1.jar
version-2.jar
version-3.jar
</code></pre>
<p>I am trying to select the highest numbered file. Is there any really simple way to do it?
Because doing <code>.\version*.jar</code> causes an error, presumably due to the... | 6,866 | 1,550,901 | 2015-06-04 14:14:22 | 11,645,344 | 15 | 2012-07-25 08:09:59 | 73,070 | 2012-07-25 08:09:59 | https://stackoverflow.com/q/11645226 | https://stackoverflow.com/a/11645344 | <p>We need delayed expansion</p>
<pre><code>setlocal enabledelayedexpansion
</code></pre>
<p>Just a variable for the maximum:</p>
<pre><code>set max=0
</code></pre>
<p>Then iterate over the files:</p>
<pre><code>for %%x in (version-*.jar) do (
</code></pre>
<p>We need the file name without extension</p>
<pre><co... | <p>We need delayed expansion</p> <pre><code>setlocal enabledelayedexpansion </code></pre> <p>Just a variable for the maximum:</p> <pre><code>set max=0 </code></pre> <p>Then iterate over the files:</p> <pre><code>for %%x in (version-*.jar) do ( </code></pre> <p>We need the file name without extension</p> <pre><co... | 64, 7002 | batch-file, windows | <h1>Choose Highest Numbered File - Batch File</h1>
<p>I have a directory full of .jar files, named progressively like so:</p>
<pre><code> version-1.jar
version-2.jar
version-3.jar
</code></pre>
<p>I am trying to select the highest numbered file. Is there any really simple way to do it?
Because doing <code>.\version... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,246 | cmd | # Choose Highest Numbered File - Batch File
I have a directory full of .jar files, named progressively like so:
```
version-1.jar
version-2.jar
version-3.jar
```
I am trying to select the highest numbered file. Is there any really simple way to do it?
Because doing `.\version*.jar` causes an error, presumably due... | We need delayed expansion
```
setlocal enabledelayedexpansion
```
Just a variable for the maximum:
```
set max=0
```
Then iterate over the files:
```
for %%x in (version-*.jar) do (
```
We need the file name without extension
```
set "FN=%%~nx"
```
And remove the `version-` from the start:
```
set "FN=!FN:... |
6671913 | Scala scripts in Windows batch files | 9 | 2011-07-12 22:19:51 | <p>In Programming in Scala, it gives a description on how to run Scala scripts from batch files (<a href="http://www.artima.com/pins1ed/scala-scripts-on-unix-and-windows.html" rel="noreferrer">link</a>).</p>
<p>For Windows</p>
<pre><code> ::#!
@echo off
call scala %0 %*
goto :eof
::!#
</code></pre>
<p>I'm h... | 5,034 | 770,361 | 2011-07-13 01:24:29 | 6,673,122 | 15 | 2011-07-13 01:24:29 | 53,013 | 2011-07-13 01:24:29 | https://stackoverflow.com/q/6671913 | https://stackoverflow.com/a/6673122 | <p>This is a gimmick, but it works. It intends to replicate Unix shell's ability to invoke a particular command to process a shell file. So, here's the explanation:</p>
<pre><code>::#!
</code></pre>
<p>Lines starting with <code>::</code> are comments in Windows shell, so this is just a comment.</p>
<pre><code>@echo ... | <p>This is a gimmick, but it works. It intends to replicate Unix shell's ability to invoke a particular command to process a shell file. So, here's the explanation:</p> <pre><code>::#! </code></pre> <p>Lines starting with <code>::</code> are comments in Windows shell, so this is just a comment.</p> <pre><code>@echo ... | 64, 531, 3143, 7002 | batch-file, scala, scripting, windows | <h1>Scala scripts in Windows batch files</h1>
<p>In Programming in Scala, it gives a description on how to run Scala scripts from batch files (<a href="http://www.artima.com/pins1ed/scala-scripts-on-unix-and-windows.html" rel="noreferrer">link</a>).</p>
<p>For Windows</p>
<pre><code> ::#!
@echo off
call scala %0... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,247 | cmd | # Scala scripts in Windows batch files
In Programming in Scala, it gives a description on how to run Scala scripts from batch files ([link](http://www.artima.com/pins1ed/scala-scripts-on-unix-and-windows.html)).
For Windows
```
::#!
@echo off
call scala %0 %*
goto :eof
::!#
```
I'm having a problem googli... | This is a gimmick, but it works. It intends to replicate Unix shell's ability to invoke a particular command to process a shell file. So, here's the explanation:
```
::#!
```
Lines starting with `::` are comments in Windows shell, so this is just a comment.
```
@echo off
```
Don't show lines executed from here on. ... |
6473385 | Problem of empty variable using set in Windows Batch | 9 | 2011-06-24 20:25:46 | <pre><code>set var=%1
echo var
set command=""
IF var==true (
set command=dir
)
IF var==false (
set command=dir /a
)
echo %command%
%command%
</code></pre>
<p>So, if I run this script by typing in</p>
<pre><code>C:\>test true
</code></pre>
<p>the <code>echo %command%</code> always prints <code>""</code>... | 47,335 | 304,319 | 2022-06-28 12:04:37 | 6,473,474 | 15 | 2011-06-24 20:33:46 | 152,522 | 2011-06-24 20:45:17 | https://stackoverflow.com/q/6473385 | https://stackoverflow.com/a/6473474 | <p>You are missing some <code>%</code> signs that are needed for any variable dereferencing.</p>
<p>You probably want it like this:</p>
<pre><code>set var=%1
echo %var%
set command=""
IF %var%==true ( <=== here
set command=dir
)
IF %var%==false ( <=== here
set comma... | <p>You are missing some <code>%</code> signs that are needed for any variable dereferencing.</p> <p>You probably want it like this:</p> <pre><code>set var=%1 echo %var% set command="" IF %var%==true ( <=== here set command=dir ) IF %var%==false ( <=== here set comma... | 7002 | batch-file | <h1>Problem of empty variable using set in Windows Batch</h1>
<pre><code>set var=%1
echo var
set command=""
IF var==true (
set command=dir
)
IF var==false (
set command=dir /a
)
echo %command%
%command%
</code></pre>
<p>So, if I run this script by typing in</p>
<pre><code>C:\>test true
</code></pre>
<p... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,248 | cmd | # Problem of empty variable using set in Windows Batch
```
set var=%1
echo var
set command=""
IF var==true (
set command=dir
)
IF var==false (
set command=dir /a
)
echo %command%
%command%
```
So, if I run this script by typing in
```
C:\>test true
```
the `echo %command%` always prints `""`. Any idea? | You are missing some `%` signs that are needed for any variable dereferencing.
You probably want it like this:
```
set var=%1
echo %var%
set command=""
IF %var%==true ( <=== here
set command=dir
)
IF %var%==false ( <=== here
set command=dir /a
)
echo %command%
%command%
`... |
4788863 | How to send series of commands to a command window process? | 9 | 2011-01-25 00:39:45 | <p>We have a few commands(batch files/executables) on our network path which we have to call to initialize our 'development environment' for that command window. It sets some environmental variables, adds stuff to the Path etc. (Then only whatever working commands we type will be recognized & I don't know what goes... | 44,411 | 501,004 | 2015-06-17 18:28:25 | 4,789,324 | 15 | 2011-01-25 02:08:30 | 529,196 | 2011-02-06 16:47:27 | https://stackoverflow.com/q/4788863 | https://stackoverflow.com/a/4789324 | <p>As @Hakeem has pointed out, <code>System.Diagnostic.Process</code> does not have a static <code>Run</code> method. I think you are referring to the method Start.
<br>
Once you have completed building the batch file, then simply execute it using the following code,
<br></p>
<pre><code>Process p = new Process();
p.S... | <p>As @Hakeem has pointed out, <code>System.Diagnostic.Process</code> does not have a static <code>Run</code> method. I think you are referring to the method Start. <br> Once you have completed building the batch file, then simply execute it using the following code, <br></p> <pre><code>Process p = new Process(); p.S... | 9, 2631, 5910 | c#, cmd, process | <h1>How to send series of commands to a command window process?</h1>
<p>We have a few commands(batch files/executables) on our network path which we have to call to initialize our 'development environment' for that command window. It sets some environmental variables, adds stuff to the Path etc. (Then only whatever wor... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,249 | cmd | # How to send series of commands to a command window process?
We have a few commands(batch files/executables) on our network path which we have to call to initialize our 'development environment' for that command window. It sets some environmental variables, adds stuff to the Path etc. (Then only whatever working comm... | As @Hakeem has pointed out, `System.Diagnostic.Process` does not have a static `Run` method. I think you are referring to the method Start.
Once you have completed building the batch file, then simply execute it using the following code,
```
Process p = new Process();
p.StartInfo.FileName = batchFilePath;
p.StartIn... |
3923894 | How to read data from COM port using batch file? | 9 | 2010-10-13 13:01:04 | <p>Is there a DOS/ Batch command which can be used for reading from the COM port?</p>
<p>I tried to look for that but didn't find solution.</p>
| 64,352 | null | 2014-09-18 11:44:59 | 3,924,069 | 15 | 2010-10-13 13:18:51 | 244,026 | 2010-10-13 15:39:33 | https://stackoverflow.com/q/3923894 | https://stackoverflow.com/a/3924069 | <p>For reading some information from COM port you can try next command:</p>
<pre><code>type COM{n}
</code></pre>
<p>For sending info to COM port use next command:</p>
<pre><code>echo some text > COM{n}
</code></pre>
| <p>For reading some information from COM port you can try next command:</p> <pre><code>type COM{n} </code></pre> <p>For sending info to COM port use next command:</p> <pre><code>echo some text > COM{n} </code></pre> | 64, 1231, 3716, 7002 | batch-file, command-line, serial-port, windows | <h1>How to read data from COM port using batch file?</h1>
<p>Is there a DOS/ Batch command which can be used for reading from the COM port?</p>
<p>I tried to look for that but didn't find solution.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,250 | cmd | # How to read data from COM port using batch file?
Is there a DOS/ Batch command which can be used for reading from the COM port?
I tried to look for that but didn't find solution. | For reading some information from COM port you can try next command:
```
type COM{n}
```
For sending info to COM port use next command:
```
echo some text > COM{n}
``` |
3091595 | If not exists then exit + cmd | 9 | 2010-06-22 08:50:45 | <p>i try to make a loop in a .cmd file.</p>
<p>If test.txt is not exists then i will kill the cmd process.</p>
<pre><code>@echo off
if not exists test.txt goto exit
</code></pre>
<p>But this code doesn't work and i don't know how to make a loop every 2 seconds.</p>
<p>Thanks for help.</p>
| 35,759 | 360,155 | 2015-06-04 14:00:09 | 3,091,653 | 15 | 2010-06-22 09:00:19 | 52,444 | 2010-06-22 09:09:37 | https://stackoverflow.com/q/3091595 | https://stackoverflow.com/a/3091653 | <p>The command is called <code>exist</code>, not <em>exists</em>:</p>
<pre><code>if not exist test.txt goto :exit
echo file exists
:exit
</code></pre>
<p>About your loop:<br>
I am not 100% sure, but I think there is no <em>sleep</em> or <em>wait</em> command in Windows. You can google for <em>sleep</em> to find some ... | <p>The command is called <code>exist</code>, not <em>exists</em>:</p> <pre><code>if not exist test.txt goto :exit echo file exists :exit </code></pre> <p>About your loop:<br> I am not 100% sure, but I think there is no <em>sleep</em> or <em>wait</em> command in Windows. You can google for <em>sleep</em> to find some ... | 2631, 5370 | cmd, dos | <h1>If not exists then exit + cmd</h1>
<p>i try to make a loop in a .cmd file.</p>
<p>If test.txt is not exists then i will kill the cmd process.</p>
<pre><code>@echo off
if not exists test.txt goto exit
</code></pre>
<p>But this code doesn't work and i don't know how to make a loop every 2 seconds.</p>
<p>Thanks f... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,251 | cmd | # If not exists then exit + cmd
i try to make a loop in a .cmd file.
If test.txt is not exists then i will kill the cmd process.
```
@echo off
if not exists test.txt goto exit
```
But this code doesn't work and i don't know how to make a loop every 2 seconds.
Thanks for help. | The command is called `exist`, not *exists*:
```
if not exist test.txt goto :exit
echo file exists
:exit
```
About your loop:
I am not 100% sure, but I think there is no *sleep* or *wait* command in Windows. You can google for *sleep* to find some freeware. Another possibility is to use a *ping*:
```
ping localhos... |
324779 | Strategies for speeding up batch ORM operations in Django | 9 | 2008-11-27 23:01:18 | <p>One of my API calls can result in updates to a large number of objects (Django models). I'm running into performance issues with this since I'm updating each item individually, saving, and moving on to the next:</p>
<pre><code>for item in Something.objects.filter(x='y'):
item.a="something"
item.save()
</cod... | 3,726 | 13,055 | 2013-09-07 23:59:58 | 325,066 | 15 | 2008-11-28 04:39:02 | 6,760 | 2008-11-28 04:39:02 | https://stackoverflow.com/q/324779 | https://stackoverflow.com/a/325066 | <p>The ticket you linked to is for bulk creation - if you're not relying on an overridden <code>save</code> method or pre/post save signals to do bits of work on save, <a href="http://docs.djangoproject.com/en/dev/topics/db/queries/#updating-multiple-objects-at-once" rel="noreferrer"><code>QuerySet</code> has an <code>... | <p>The ticket you linked to is for bulk creation - if you're not relying on an overridden <code>save</code> method or pre/post save signals to do bits of work on save, <a href="http://docs.djangoproject.com/en/dev/topics/db/queries/#updating-multiple-objects-at-once" rel="noreferrer"><code>QuerySet</code> has an <code>... | 16, 243, 647, 7002 | batch-file, django, orm, python | <h1>Strategies for speeding up batch ORM operations in Django</h1>
<p>One of my API calls can result in updates to a large number of objects (Django models). I'm running into performance issues with this since I'm updating each item individually, saving, and moving on to the next:</p>
<pre><code>for item in Something.... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,252 | cmd | # Strategies for speeding up batch ORM operations in Django
One of my API calls can result in updates to a large number of objects (Django models). I'm running into performance issues with this since I'm updating each item individually, saving, and moving on to the next:
```
for item in Something.objects.filter(x='y'... | The ticket you linked to is for bulk creation - if you're not relying on an overridden `save` method or pre/post save signals to do bits of work on save, [`QuerySet` has an `update` method](http://docs.djangoproject.com/en/dev/topics/db/queries/#updating-multiple-objects-at-once) which you can use to perform an `UPDATE... |
46636 | Copying from network share using BAT | 9 | 2008-09-05 19:17:15 | <p>What's the best way to copy a file from a network share to the local file system using a Windows batch file? Normally, I would use "net use *" but using this approach how can I get the drive letter?</p>
| 21,699 | 4,778 | 2019-12-13 16:02:09 | 46,640 | 15 | 2008-09-05 19:18:23 | 305 | 2008-09-05 19:18:23 | https://stackoverflow.com/q/46636 | https://stackoverflow.com/a/46640 | <p>Can you just use the full UNC path to the file?</p>
<pre><code>copy \\myserver\myshare\myfolder\myfile.txt c:\myfiles
</code></pre>
| <p>Can you just use the full UNC path to the file?</p> <pre><code>copy \\myserver\myshare\myfolder\myfile.txt c:\myfiles </code></pre> | 64, 7002 | batch-file, windows | <h1>Copying from network share using BAT</h1>
<p>What's the best way to copy a file from a network share to the local file system using a Windows batch file? Normally, I would use "net use *" but using this approach how can I get the drive letter?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,253 | cmd | # Copying from network share using BAT
What's the best way to copy a file from a network share to the local file system using a Windows batch file? Normally, I would use "net use *" but using this approach how can I get the drive letter? | Can you just use the full UNC path to the file?
```
copy \\myserver\myshare\myfolder\myfile.txt c:\myfiles
``` |
53672875 | Property spring.datasource.schema with value 'class path resource [schema-mysql.sql]' is invalid: The specified resource does not exist | 8 | 2018-12-07 15:52:44 | <p>I am developing <strong>Spring Boot + Batch</strong> very basic example. Version of Boot is <code>2.1.1.RELEASE</code>. In this example, I used <code>schema-mysql.sql</code> and expecting to create the Batch metadata examples automatically, but its giving error.</p>
<p>Any quick pointers? Using MYSQL version <code>... | 15,043 | 2,929,562 | 2020-11-11 11:58:37 | 55,143,648 | 15 | 2019-03-13 13:57:09 | 1,610,005 | 2019-03-13 13:57:09 | https://stackoverflow.com/q/53672875 | https://stackoverflow.com/a/55143648 | <p>Its old thread but someone else can get benefit of it, here full package class path and <code>initialize schema always</code> has to define..</p>
<p>need to define these properties:</p>
<pre><code>spring.datasource.schema=classpath:/org/springframework/batch/core/schema-mysql.sql
spring.batch.initialize-schema=alw... | <p>Its old thread but someone else can get benefit of it, here full package class path and <code>initialize schema always</code> has to define..</p> <p>need to define these properties:</p> <pre><code>spring.datasource.schema=classpath:/org/springframework/batch/core/schema-mysql.sql spring.batch.initialize-schema=alw... | 1211, 41895, 95875 | spring, spring-batch, spring-boot | <h1>Property spring.datasource.schema with value 'class path resource [schema-mysql.sql]' is invalid: The specified resource does not exist</h1>
<p>I am developing <strong>Spring Boot + Batch</strong> very basic example. Version of Boot is <code>2.1.1.RELEASE</code>. In this example, I used <code>schema-mysql.sql</code... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,254 | cmd | # Property spring.datasource.schema with value 'class path resource [schema-mysql.sql]' is invalid: The specified resource does not exist
I am developing **Spring Boot + Batch** very basic example. Version of Boot is `2.1.1.RELEASE`. In this example, I used `schema-mysql.sql` and expecting to create the Batch metadata... | Its old thread but someone else can get benefit of it, here full package class path and `initialize schema always` has to define..
need to define these properties:
```
spring.datasource.schema=classpath:/org/springframework/batch/core/schema-mysql.sql
spring.batch.initialize-schema=always
```
or in yml file:
```
sp... |
41669330 | Windows Batch - How to get the external IP into a batch-file variable | 8 | 2017-01-16 04:13:17 | <p>I am making a program that checks if a user's IP is a certain IP address.</p>
<p>Currently, I created a successful internal IP version:</p>
<pre><code>@echo off
set userIp=192.168.90.100
for /f "tokens=4 delims= " %%i in ('route print ^| find " 0.0.0.0"') do set localIp=%%i
for /f "delims=[]... | 10,436 | 7,419,054 | 2022-10-01 02:01:01 | 41,677,062 | 15 | 2017-01-16 13:03:33 | null | 2019-04-05 20:46:13 | https://stackoverflow.com/q/41669330 | https://stackoverflow.com/a/41677062 | <p>With pure batch/already present tools:<br>
<strong>EDIT: changed the batch to properly handle also IPv6 addresses</strong></p>
<pre><code>@Echo off
for /f "tokens=1* delims=: " %%A in (
'nslookup myip.opendns.com. resolver1.opendns.com 2^>NUL^|find "Address:"'
) Do set ExtIP=%%B
Echo External IP is : %ExtIP%
<... | <p>With pure batch/already present tools:<br> <strong>EDIT: changed the batch to properly handle also IPv6 addresses</strong></p> <pre><code>@Echo off for /f "tokens=1* delims=: " %%A in ( 'nslookup myip.opendns.com. resolver1.opendns.com 2^>NUL^|find "Address:"' ) Do set ExtIP=%%B Echo External IP is : %ExtIP% <... | 64, 294, 7002 | batch-file, ip, windows | <h1>Windows Batch - How to get the external IP into a batch-file variable</h1>
<p>I am making a program that checks if a user's IP is a certain IP address.</p>
<p>Currently, I created a successful internal IP version:</p>
<pre><code>@echo off
set userIp=192.168.90.100
for /f "tokens=4 delims= " %%i in ('route... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,255 | cmd | # Windows Batch - How to get the external IP into a batch-file variable
I am making a program that checks if a user's IP is a certain IP address.
Currently, I created a successful internal IP version:
```
@echo off
set userIp=192.168.90.100
for /f "tokens=4 delims= " %%i in ('route print ^| find " 0.0.0.0"') do set ... | With pure batch/already present tools:
**EDIT: changed the batch to properly handle also IPv6 addresses**
```
@Echo off
for /f "tokens=1* delims=: " %%A in (
'nslookup myip.opendns.com. resolver1.opendns.com 2^>NUL^|find "Address:"'
) Do set ExtIP=%%B
Echo External IP is : %ExtIP%
```
[Reference](https://superuse... |
33096835 | Batch with Spring Boot & JPA - use in-memory datasource for batch-related tables | 8 | 2015-10-13 07:40:36 | <p><strong>Context</strong></p>
<p>I'm trying to develop a batch service with Spring Boot, using JPA Repository. Using two different datasources, I want the batch-related tables created in a in-memory database, so that it does not pollute my business database.</p>
<p>Following multiple topics on the web, I came up wi... | 11,072 | 3,506,022 | 2018-03-06 14:43:19 | 33,099,885 | 15 | 2015-10-13 10:08:05 | 3,506,022 | 2018-03-06 14:43:19 | https://stackoverflow.com/q/33096835 | https://stackoverflow.com/a/33099885 | <p>I finally solved the problem implementing my own BatchConfigurer, on the base of the Spring class BasicBatchConfigurer, and forcing the use of Map based jobRepository and jobExplorer. No more custom datasource configuration, only one datasource which I let Spring Boot manage : it's easier that way.</p>
<p>My custom... | <p>I finally solved the problem implementing my own BatchConfigurer, on the base of the Spring class BasicBatchConfigurer, and forcing the use of Map based jobRepository and jobExplorer. No more custom datasource configuration, only one datasource which I let Spring Boot manage : it's easier that way.</p> <p>My custom... | 1211, 2990, 41895, 95875 | jpa, spring, spring-batch, spring-boot | <h1>Batch with Spring Boot & JPA - use in-memory datasource for batch-related tables</h1>
<p><strong>Context</strong></p>
<p>I'm trying to develop a batch service with Spring Boot, using JPA Repository. Using two different datasources, I want the batch-related tables created in a in-memory database, so that it does no... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,256 | cmd | # Batch with Spring Boot & JPA - use in-memory datasource for batch-related tables
**Context**
I'm trying to develop a batch service with Spring Boot, using JPA Repository. Using two different datasources, I want the batch-related tables created in a in-memory database, so that it does not pollute my business databas... | I finally solved the problem implementing my own BatchConfigurer, on the base of the Spring class BasicBatchConfigurer, and forcing the use of Map based jobRepository and jobExplorer. No more custom datasource configuration, only one datasource which I let Spring Boot manage : it's easier that way.
My custom BatchConf... |
25752409 | How can i export my event logs to a folder (csv or txt) on every start up automatically? | 8 | 2014-09-09 19:43:31 | <p>I was looking for either a batch file, powerscript (not really good with yet)or any way to have my event logs exported to txt or csv on every start up?
Im using windows 7 pro if that helps</p>
| 33,576 | 4,024,292 | 2014-09-11 20:17:31 | 25,752,551 | 15 | 2014-09-09 19:53:01 | 388,389 | 2014-09-09 19:58:33 | https://stackoverflow.com/q/25752409 | https://stackoverflow.com/a/25752551 | <p>This will output last 20 system event logs in <code>eventlog.txt</code>.Not sure what exactly you need from eventlog - it's a big place... </p>
<pre><code>WEVTUtil query-events System /count:20 /rd:true /format:text > eventlog.txt
</code></pre>
<p>You can change System to Application,Security or Setup - not sur... | <p>This will output last 20 system event logs in <code>eventlog.txt</code>.Not sure what exactly you need from eventlog - it's a big place... </p> <pre><code>WEVTUtil query-events System /count:20 /rd:true /format:text > eventlog.txt </code></pre> <p>You can change System to Application,Security or Setup - not sur... | 7002, 10539, 19948, 65062 | batch-file, crash-reports, event-viewer, export-to-csv | <h1>How can i export my event logs to a folder (csv or txt) on every start up automatically?</h1>
<p>I was looking for either a batch file, powerscript (not really good with yet)or any way to have my event logs exported to txt or csv on every start up?
Im using windows 7 pro if that helps</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,257 | cmd | # How can i export my event logs to a folder (csv or txt) on every start up automatically?
I was looking for either a batch file, powerscript (not really good with yet)or any way to have my event logs exported to txt or csv on every start up?
Im using windows 7 pro if that helps | This will output last 20 system event logs in `eventlog.txt`.Not sure what exactly you need from eventlog - it's a big place...
```
WEVTUtil query-events System /count:20 /rd:true /format:text > eventlog.txt
```
You can change System to Application,Security or Setup - not sure what exactly you need.
more info:
<http... |
10432598 | Copy Only Missing Files | 8 | 2012-05-03 13:39:10 | <p>Let me preface this question by saying that I am relatively new to writing batch files, so I apologize if my question seems remedial.</p>
<p>I'm trying to move files from a directory to a shared drive that I have mapped. I know that using "XCOPY c:\etc.. z:\etc.. /Y" will copy everything from one place to another,... | 23,958 | 714,741 | 2023-10-17 14:44:17 | 10,432,670 | 15 | 2012-05-03 13:42:54 | 859,154 | 2012-05-03 15:22:22 | https://stackoverflow.com/q/10432598 | https://stackoverflow.com/a/10432670 | <h2>solution 1 :</h2>
<pre><code>xcopy /d/y
</code></pre>
<p>should work..........</p>
<p><img src="https://i.sstatic.net/XiXIv.jpg" alt="enter image description here"></p>
<h2>solution 2</h2>
<pre><code>echo "No" | copy/-Y c:\source c:\Dest\
</code></pre>
<p>working. tested</p>
<p>2 folders have the same files... | <h2>solution 1 :</h2> <pre><code>xcopy /d/y </code></pre> <p>should work..........</p> <p><img src="https://i.sstatic.net/XiXIv.jpg" alt="enter image description here"></p> <h2>solution 2</h2> <pre><code>echo "No" | copy/-Y c:\source c:\Dest\ </code></pre> <p>working. tested</p> <p>2 folders have the same files... | 7002 | batch-file | <h1>Copy Only Missing Files</h1>
<p>Let me preface this question by saying that I am relatively new to writing batch files, so I apologize if my question seems remedial.</p>
<p>I'm trying to move files from a directory to a shared drive that I have mapped. I know that using "XCOPY c:\etc.. z:\etc.. /Y" will copy ever... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,259 | cmd | # Copy Only Missing Files
Let me preface this question by saying that I am relatively new to writing batch files, so I apologize if my question seems remedial.
I'm trying to move files from a directory to a shared drive that I have mapped. I know that using "XCOPY c:\etc.. z:\etc.. /Y" will copy everything from one p... | ## solution 1 :
```
xcopy /d/y
```
should work..........

## solution 2
```
echo "No" | copy/-Y c:\source c:\Dest\
```
working. tested
2 folders have the same files , lets try to copy.
```
C:\r\Roi>echo "No" | copy/-Y . 2
.\DSpubring.pkr
Overwri... |
9065280 | Reference a Volume/Drive by Label | 8 | 2012-01-30 14:22:30 | <p>I'm trying to write a batch file to xcopy a folder to a removable USB drive. The problem that I face, however, is that drive letters are subject to change, so I would like to be able to do this by referencing the volume label instead of the drive letter. </p>
<p>Any ideas? An hour of Google-ing has proved fruitless... | 20,957 | null | 2016-04-07 10:36:19 | 9,066,394 | 15 | 2012-01-30 15:35:36 | 1,012,053 | 2012-01-30 17:01:06 | https://stackoverflow.com/q/9065280 | https://stackoverflow.com/a/9066394 | <p>This command should discover the drive with the correct label and store the drive letter (with colon) in variable "usb"</p>
<pre><code>for /f %%D in ('wmic volume get DriveLetter^, Label ^| find "yourLabel"') do set usb=%%D
</code></pre>
<p>You could embed your xcopy command(s) directly in the DO clause if you lik... | <p>This command should discover the drive with the correct label and store the drive letter (with colon) in variable "usb"</p> <pre><code>for /f %%D in ('wmic volume get DriveLetter^, Label ^| find "yourLabel"') do set usb=%%D </code></pre> <p>You could embed your xcopy command(s) directly in the DO clause if you lik... | 1470, 1796, 4710, 6906, 7002 | batch-file, command, label, volume, xcopy | <h1>Reference a Volume/Drive by Label</h1>
<p>I'm trying to write a batch file to xcopy a folder to a removable USB drive. The problem that I face, however, is that drive letters are subject to change, so I would like to be able to do this by referencing the volume label instead of the drive letter. </p>
<p>Any ideas?... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,260 | cmd | # Reference a Volume/Drive by Label
I'm trying to write a batch file to xcopy a folder to a removable USB drive. The problem that I face, however, is that drive letters are subject to change, so I would like to be able to do this by referencing the volume label instead of the drive letter.
Any ideas? An hour of Googl... | This command should discover the drive with the correct label and store the drive letter (with colon) in variable "usb"
```
for /f %%D in ('wmic volume get DriveLetter^, Label ^| find "yourLabel"') do set usb=%%D
```
You could embed your xcopy command(s) directly in the DO clause if you like. %%D contains the drive l... |
7511884 | how to access server using cmd( \\Server\Volume\File) | 8 | 2011-09-22 08:32:22 | <p>I need to get folder names in my server, as you know when you start cmd.exe it has default path name like "C:\Documents and ....". I can get folder names which are in my "C:/" by typing <code>dir *.* /b /o:n > index.txt</code>. </p>
<p>so I have this;
<code>C:\Documents and Settings\Name>dir *.* /b /o:n > ... | 54,356 | 936,355 | 2017-05-30 11:09:54 | 7,511,901 | 15 | 2011-09-22 08:33:33 | 457,352 | 2011-09-22 08:33:33 | https://stackoverflow.com/q/7511884 | https://stackoverflow.com/a/7511901 | <p>Use:</p>
<pre><code>pushd \\Server\Volume
dir
popd
</code></pre>
| <p>Use:</p> <pre><code>pushd \\Server\Volume dir popd </code></pre> | 2631 | cmd | <h1>how to access server using cmd( \\Server\Volume\File)</h1>
<p>I need to get folder names in my server, as you know when you start cmd.exe it has default path name like "C:\Documents and ....". I can get folder names which are in my "C:/" by typing <code>dir *.* /b /o:n > index.txt</code>. </p>
<p>so I have this... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,261 | cmd | # how to access server using cmd( \\Server\Volume\File)
I need to get folder names in my server, as you know when you start cmd.exe it has default path name like "C:\Documents and ....". I can get folder names which are in my "C:/" by typing `dir *.* /b /o:n > index.txt`.
so I have this;
`C:\Documents and Settings\Na... | Use:
```
pushd \\Server\Volume
dir
popd
``` |
2874308 | Using a batch file to create folder and copy files into it to multiple PCs | 8 | 2010-05-20 13:48:57 | <p>I have a folder with numerous files that I need to copy to multiple PCs on a network. I thought if the folder didn't exist it would automatically create it. Here's what I have...</p>
<p>copy "C:\Documents and Settings\follag\Desktop\Music" "\PC NAME\c$\Documents and Settings\All Users\Desktop\Music" </p>
<p>When I... | 46,429 | 346,165 | 2016-10-20 14:08:34 | 2,874,414 | 15 | 2010-05-20 14:01:14 | 334,849 | 2010-05-20 14:01:14 | https://stackoverflow.com/q/2874308 | https://stackoverflow.com/a/2874414 | <p>Try </p>
<pre><code>xcopy "C:\Documents and Settings\follag\Desktop\Music" "\PC NAME\c$\Documents and Settings\All Users\Desktop\Music" /E /I
</code></pre>
| <p>Try </p> <pre><code>xcopy "C:\Documents and Settings\follag\Desktop\Music" "\PC NAME\c$\Documents and Settings\All Users\Desktop\Music" /E /I </code></pre> | 64, 7002 | batch-file, windows | <h1>Using a batch file to create folder and copy files into it to multiple PCs</h1>
<p>I have a folder with numerous files that I need to copy to multiple PCs on a network. I thought if the folder didn't exist it would automatically create it. Here's what I have...</p>
<p>copy "C:\Documents and Settings\follag\Desktop... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,262 | cmd | # Using a batch file to create folder and copy files into it to multiple PCs
I have a folder with numerous files that I need to copy to multiple PCs on a network. I thought if the folder didn't exist it would automatically create it. Here's what I have...
copy "C:\Documents and Settings\follag\Desktop\Music" "\PC NAM... | Try
```
xcopy "C:\Documents and Settings\follag\Desktop\Music" "\PC NAME\c$\Documents and Settings\All Users\Desktop\Music" /E /I
``` |
2634959 | 2 batch string questions | 8 | 2010-04-14 04:46:12 | <p>1) Is there any built-in which can tell me if a variable's contents contain only uppercase letters?</p>
<p>2) is there any way to see if a variable contains a string? For example, I'd like to see if the variable %PATH% contains Ruby.</p>
| 11,517 | 31,610 | 2012-07-26 01:05:56 | 2,635,137 | 15 | 2010-04-14 05:46:56 | 14,860 | 2012-07-26 01:05:56 | https://stackoverflow.com/q/2634959 | https://stackoverflow.com/a/2635137 | <p>For part 1, <code>findstr</code> is the answer. You can just use the regex feature along with <code>errorlevel</code>:</p>
<pre><code>> set xxokay=ABC
> set xxbad=AB1C
> echo %xxokay%|findstr /r "^[A-Z]*$" >nul:
> echo %errorlevel%
0
> echo %xxbad%|findstr /r "^[A-Z]*$" >nul:
> echo %errorle... | <p>For part 1, <code>findstr</code> is the answer. You can just use the regex feature along with <code>errorlevel</code>:</p> <pre><code>> set xxokay=ABC > set xxbad=AB1C > echo %xxokay%|findstr /r "^[A-Z]*$" >nul: > echo %errorlevel% 0 > echo %xxbad%|findstr /r "^[A-Z]*$" >nul: > echo %errorle... | 139, 7002 | batch-file, string | <h1>2 batch string questions</h1>
<p>1) Is there any built-in which can tell me if a variable's contents contain only uppercase letters?</p>
<p>2) is there any way to see if a variable contains a string? For example, I'd like to see if the variable %PATH% contains Ruby.</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,263 | cmd | # 2 batch string questions
1) Is there any built-in which can tell me if a variable's contents contain only uppercase letters?
2) is there any way to see if a variable contains a string? For example, I'd like to see if the variable %PATH% contains Ruby. | For part 1, `findstr` is the answer. You can just use the regex feature along with `errorlevel`:
```
> set xxokay=ABC
> set xxbad=AB1C
> echo %xxokay%|findstr /r "^[A-Z]*$" >nul:
> echo %errorlevel%
0
> echo %xxbad%|findstr /r "^[A-Z]*$" >nul:
> echo %errorlevel%
1
```
It's important in this case that you do *not* ha... |
770076 | What exactly is this batch file supposed to do? | 8 | 2009-04-20 21:03:10 | <p>What does this do in a .bat file?</p>
<p>Is it some sort of assembly language or what?</p>
<pre>
@debug <%0 >nul
e100 48 e6 61 be 3f 01 31 db 8a 1c 80 fb ff 74 f4 81
e110 c3 d0 00 b0 b6 e6 43 31 d2 66 b8 dd 34 12 00 66
e120 f7 f3 e6 42 88 e0 e6 42 46 8a 0c 46 ba da 03 ec
e130 a8 08 74 fb ... | 2,218 | null | 2009-04-27 04:30:39 | 770,373 | 15 | 2009-04-20 22:34:31 | 8,701 | 2009-04-27 04:30:39 | https://stackoverflow.com/q/770076 | https://stackoverflow.com/a/770373 | <p>Look at Dan Olson's <a href="https://stackoverflow.com/questions/770076/what-exactly-is-this-batch-file-supposed-to-do/770156#770156">dissasembly</a>, it looks like a short program that loops through and plays some music:</p>
<pre><code>out 0x61
</code></pre>
<p>Turns on the pc speaker on and off.</p>
<pre><code>... | <p>Look at Dan Olson's <a href="https://stackoverflow.com/questions/770076/what-exactly-is-this-batch-file-supposed-to-do/770156#770156">dissasembly</a>, it looks like a short program that loops through and plays some music:</p> <pre><code>out 0x61 </code></pre> <p>Turns on the pc speaker on and off.</p> <pre><code>... | 516, 1391, 7002 | batch-file, hex, obfuscation | <h1>What exactly is this batch file supposed to do?</h1>
<p>What does this do in a .bat file?</p>
<p>Is it some sort of assembly language or what?</p>
<pre>
@debug <%0 >nul
e100 48 e6 61 be 3f 01 31 db 8a 1c 80 fb ff 74 f4 81
e110 c3 d0 00 b0 b6 e6 43 31 d2 66 b8 dd 34 12 00 66
e120 f7 f3 e6 42 ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,264 | cmd | # What exactly is this batch file supposed to do?
What does this do in a .bat file?
Is it some sort of assembly language or what?
```
@debug <%0 >nul
e100 48 e6 61 be 3f 01 31 db 8a 1c 80 fb ff 74 f4 81
e110 c3 d0 00 b0 b6 e6 43 31 d2 66 b8 dd 34 12 00 66
e120 f7 f3 e6 42 88 e0 e6 42 46 8a 0c 46 ba d... | Look at Dan Olson's [dissasembly](https://stackoverflow.com/questions/770076/what-exactly-is-this-batch-file-supposed-to-do/770156#770156), it looks like a short program that loops through and plays some music:
```
out 0x61
```
Turns on the pc speaker on and off.
```
out 0x43
```
Sets up the system timer to generat... |
39101129 | Call .exe from batch file with variable path containing spaces | 7 | 2016-08-23 12:23:44 | <p>I want to launch a windows executable from a batch file where the path to the executable is stored in a variable.</p>
<pre class="lang-sh prettyprint-override"><code>@echo off
set qtpath=C:\Program Files\Qt\5.7\mingw53_32\bin
set execpath=%qtpath%\windeployqt.exe
echo %execpath%
%execpath% --someparams
</code></... | 15,925 | 2,657,815 | 2022-07-30 14:50:46 | 39,105,763 | 15 | 2016-08-23 15:54:33 | 5,047,996 | 2021-08-22 15:43:34 | https://stackoverflow.com/q/39101129 | https://stackoverflow.com/a/39105763 | <p>You should change your code to this:</p>
<pre><code>@echo off
set "qtpath=C:\Program Files\Qt\5.7\mingw53_32\bin"
set "execpath=%qtpath%\windeployqt.exe"
echo "%execpath%"
"%execpath%" --someparams
</code></pre>
<p>The <kbd>SPACE</kbd>, like also <kbd>TAB</kbd>, <code>,</co... | <p>You should change your code to this:</p> <pre><code>@echo off set "qtpath=C:\Program Files\Qt\5.7\mingw53_32\bin" set "execpath=%qtpath%\windeployqt.exe" echo "%execpath%" "%execpath%" --someparams </code></pre> <p>The <kbd>SPACE</kbd>, like also <kbd>TAB</kbd>, <code>,</co... | 64, 2631, 7002 | batch-file, cmd, windows | <h1>Call .exe from batch file with variable path containing spaces</h1>
<p>I want to launch a windows executable from a batch file where the path to the executable is stored in a variable.</p>
<pre class="lang-sh prettyprint-override"><code>@echo off
set qtpath=C:\Program Files\Qt\5.7\mingw53_32\bin
set execpath=%qtp... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,265 | cmd | # Call .exe from batch file with variable path containing spaces
I want to launch a windows executable from a batch file where the path to the executable is stored in a variable.
```
@echo off
set qtpath=C:\Program Files\Qt\5.7\mingw53_32\bin
set execpath=%qtpath%\windeployqt.exe
echo %execpath%
%execpath% --somep... | You should change your code to this:
```
@echo off
set "qtpath=C:\Program Files\Qt\5.7\mingw53_32\bin"
set "execpath=%qtpath%\windeployqt.exe"
echo "%execpath%"
"%execpath%" --someparams
```
The `SPACE`, like also `TAB`, `,`, `;`, `=`, `VTAB` (vertical tabulator, ASCII `0x0B`), `FF` (form-feed, ASCII `0x0C`) and `... |
24756987 | Facebook graph API 'ids' variable limit | 7 | 2014-07-15 11:26:43 | <p>I'm making API calls to retrieve simple data from Facebook pages:</p>
<pre><code>/[page_id]?fields=likes,talking_about_count,checkins
</code></pre>
<p>I know I can get multiple results by providing multiple ids using the 'ids' variable:</p>
<pre><code>/?ids=[page_id],[page_id],[page_id]&fields=likes,talking_a... | 4,583 | 1,291,693 | 2016-11-02 21:08:57 | 28,346,186 | 15 | 2015-02-05 14:13:01 | 1,390,134 | 2016-11-02 21:08:57 | https://stackoverflow.com/q/24756987 | https://stackoverflow.com/a/28346186 | <p>I used Graph Explorer to list all post ids on a page. It returned me 140 posts.
I then sent those 140 posts to the Graph API using the <code>ids</code> parameter and got this in return:</p>
<pre><code>{
"error": {
"message": "(#100) Too many IDs. Maximum: 50. Provided: 140.",
"type": "OAuthException",
... | <p>I used Graph Explorer to list all post ids on a page. It returned me 140 posts. I then sent those 140 posts to the Graph API using the <code>ids</code> parameter and got this in return:</p> <pre><code>{ "error": { "message": "(#100) Too many IDs. Maximum: 50. Provided: 140.", "type": "OAuthException", ... | 2218, 56957, 72691 | facebook, facebook-batch-request, facebook-graph-api | <h1>Facebook graph API 'ids' variable limit</h1>
<p>I'm making API calls to retrieve simple data from Facebook pages:</p>
<pre><code>/[page_id]?fields=likes,talking_about_count,checkins
</code></pre>
<p>I know I can get multiple results by providing multiple ids using the 'ids' variable:</p>
<pre><code>/?ids=[page_i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,267 | cmd | # Facebook graph API 'ids' variable limit
I'm making API calls to retrieve simple data from Facebook pages:
```
/[page_id]?fields=likes,talking_about_count,checkins
```
I know I can get multiple results by providing multiple ids using the 'ids' variable:
```
/?ids=[page_id],[page_id],[page_id]&fields=likes,talking_... | I used Graph Explorer to list all post ids on a page. It returned me 140 posts.
I then sent those 140 posts to the Graph API using the `ids` parameter and got this in return:
```
{
"error": {
"message": "(#100) Too many IDs. Maximum: 50. Provided: 140.",
"type": "OAuthException",
"code": 100
}
}
```
... |
21657655 | How to DIRECTLY execute command in txt file in cmd? | 7 | 2014-02-09 09:56:02 | <p>I have a question. </p>
<blockquote>
<p>How can I execute command in a plain text file?</p>
</blockquote>
<p>I know it seems crazy and I can simply rename it as a .bat file BUT it is important for me.<br>
Without renaming it, can i execute it in CMD?</p>
<p>I know I can simply do this :</p>
<pre><code>ren com... | 20,304 | 3,222,831 | 2014-02-10 09:58:17 | 21,657,757 | 15 | 2014-02-09 10:06:57 | 2,861,476 | 2014-02-09 10:06:57 | https://stackoverflow.com/q/21657655 | https://stackoverflow.com/a/21657757 | <pre><code>cmd < command.txt
</code></pre>
<p>Of course it depends of the real content of command.txt.</p>
| <pre><code>cmd < command.txt </code></pre> <p>Of course it depends of the real content of command.txt.</p> | 1796, 2631, 7002 | batch-file, cmd, command | <h1>How to DIRECTLY execute command in txt file in cmd?</h1>
<p>I have a question. </p>
<blockquote>
<p>How can I execute command in a plain text file?</p>
</blockquote>
<p>I know it seems crazy and I can simply rename it as a .bat file BUT it is important for me.<br>
Without renaming it, can i execute it in CMD?<... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,268 | cmd | # How to DIRECTLY execute command in txt file in cmd?
I have a question.
> How can I execute command in a plain text file?
I know it seems crazy and I can simply rename it as a .bat file BUT it is important for me.
Without renaming it, can i execute it in CMD?
I know I can simply do this :
```
ren command.txt co... | ```
cmd < command.txt
```
Of course it depends of the real content of command.txt. |
19815531 | How do I escape a double quote with GNU grep for windows/dos? | 7 | 2013-11-06 15:05:04 | <p>I'm trying to search for </p>
<p>Assembly="Foobar</p>
<p>in all files and direct the output to tmp.txt</p>
<p>I've tried (cmd/error)</p>
<blockquote>
<p>grep -r "Assembly=\"Foobar" . >> tmp.txt
error (invalid argument) </p>
<p>grep -r "Assembly=""Foobar" . >> tmp.txt<br>
error (not enough space) </p>... | 6,929 | 782,880 | 2013-11-07 13:03:39 | 19,816,688 | 15 | 2013-11-06 15:56:10 | 1,012,053 | 2013-11-06 16:23:56 | https://stackoverflow.com/q/19815531 | https://stackoverflow.com/a/19816688 | <p>You need to worry about escaping quotes for both grep and cmd.exe</p>
<p>grep expects quotes to be escaped as <code>\"</code></p>
<p>cmd.exe escapes quotes as <code>^"</code>. The quote is a state machine, meaning unescaped quotes toggle quote semantics on and off. When quoting is on, special characters like <code... | <p>You need to worry about escaping quotes for both grep and cmd.exe</p> <p>grep expects quotes to be escaped as <code>\"</code></p> <p>cmd.exe escapes quotes as <code>^"</code>. The quote is a state machine, meaning unescaped quotes toggle quote semantics on and off. When quoting is on, special characters like <code... | 1271, 2631, 4072 | cmd, gnu, grep | <h1>How do I escape a double quote with GNU grep for windows/dos?</h1>
<p>I'm trying to search for </p>
<p>Assembly="Foobar</p>
<p>in all files and direct the output to tmp.txt</p>
<p>I've tried (cmd/error)</p>
<blockquote>
<p>grep -r "Assembly=\"Foobar" . >> tmp.txt
error (invalid argument) </p>
<p>grep ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,269 | cmd | # How do I escape a double quote with GNU grep for windows/dos?
I'm trying to search for
Assembly="Foobar
in all files and direct the output to tmp.txt
I've tried (cmd/error)
> grep -r "Assembly=\"Foobar" . >> tmp.txt
> error (invalid argument)
>
> grep -r "Assembly=""Foobar" . >> tmp.txt
> error (not enough spa... | You need to worry about escaping quotes for both grep and cmd.exe
grep expects quotes to be escaped as `\"`
cmd.exe escapes quotes as `^"`. The quote is a state machine, meaning unescaped quotes toggle quote semantics on and off. When quoting is on, special characters like `<`, `|`, `&`, etc are treated as literals. ... |
18770362 | How to make cmd correctly display arabic script? | 7 | 2013-09-12 17:07:23 | <p>I am running windows 7 and using a python script that outputs some strings in arabic to windows cmd. This is what I get:</p>
<p><img src="https://i.sstatic.net/jPL1n.jpg" alt="enter image description here"></p>
<p>How do I configure cmd show arabic strings correctly?</p>
| 16,941 | 1,984,680 | 2013-09-12 17:27:12 | 18,770,463 | 15 | 2013-09-12 17:12:59 | 1,401,900 | 2013-09-12 17:12:59 | https://stackoverflow.com/q/18770362 | https://stackoverflow.com/a/18770463 | <p>Change your <code>cmd</code>'s code page to the encoding you're outputting:</p>
<pre><code>chcp 1256
</code></pre>
<p>That <code>1256</code> is an <a href="http://msdn.microsoft.com/en-us/library/cc195058.aspx" rel="noreferrer">Arabic code page for Windows</a> If you're outputting in another encoding, just find th... | <p>Change your <code>cmd</code>'s code page to the encoding you're outputting:</p> <pre><code>chcp 1256 </code></pre> <p>That <code>1256</code> is an <a href="http://msdn.microsoft.com/en-us/library/cc195058.aspx" rel="noreferrer">Arabic code page for Windows</a> If you're outputting in another encoding, just find th... | 16, 64, 2631, 9986, 12658 | arabic, character-encoding, cmd, python, windows | <h1>How to make cmd correctly display arabic script?</h1>
<p>I am running windows 7 and using a python script that outputs some strings in arabic to windows cmd. This is what I get:</p>
<p><img src="https://i.sstatic.net/jPL1n.jpg" alt="enter image description here"></p>
<p>How do I configure cmd show arabic strings ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,270 | cmd | # How to make cmd correctly display arabic script?
I am running windows 7 and using a python script that outputs some strings in arabic to windows cmd. This is what I get:

How do I configure cmd show arabic strings correctly? | Change your `cmd`'s code page to the encoding you're outputting:
```
chcp 1256
```
That `1256` is an [Arabic code page for Windows](http://msdn.microsoft.com/en-us/library/cc195058.aspx) If you're outputting in another encoding, just find them in the [whole list of code pages](http://msdn.microsoft.com/en-us/library/... |
17843156 | How to appcfg rollback my project? | 7 | 2013-07-24 19:28:16 | <p>I am using <strong>Google App Engine</strong> to upload my python project However once I try to upload my project I receive this error:</p>
<pre><code>2013-07-24 20:21:06 Running command: "['C:\\Python26\\python.exe', '-u', 'C:\\Program Files\\Google\\google_appengine\\appcfg.py', '--no_cookies', u'--email=thomasst... | 7,940 | 2,569,812 | 2017-10-13 21:57:44 | 17,846,183 | 15 | 2013-07-24 22:54:05 | 1,352,749 | 2013-07-24 22:54:05 | https://stackoverflow.com/q/17843156 | https://stackoverflow.com/a/17846183 | <p>You need to cd into the src folder.</p>
<p>Then do:</p>
<pre><code>appcfg.py --no_cookies --email=YOUR_EMAIL_HERE@gmail.com --passin rollback ./
</code></pre>
<p>That always does the trick for me.</p>
| <p>You need to cd into the src folder.</p> <p>Then do:</p> <pre><code>appcfg.py --no_cookies --email=YOUR_EMAIL_HERE@gmail.com --passin rollback ./ </code></pre> <p>That always does the trick for me.</p> | 984, 2631 | cmd, google-app-engine | <h1>How to appcfg rollback my project?</h1>
<p>I am using <strong>Google App Engine</strong> to upload my python project However once I try to upload my project I receive this error:</p>
<pre><code>2013-07-24 20:21:06 Running command: "['C:\\Python26\\python.exe', '-u', 'C:\\Program Files\\Google\\google_appengine\\ap... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,271 | cmd | # How to appcfg rollback my project?
I am using **Google App Engine** to upload my python project However once I try to upload my project I receive this error:
```
2013-07-24 20:21:06 Running command: "['C:\\Python26\\python.exe', '-u', 'C:\\Program Files\\Google\\google_appengine\\appcfg.py', '--no_cookies', u'--ema... | You need to cd into the src folder.
Then do:
```
appcfg.py --no_cookies --email=YOUR_EMAIL_HERE@gmail.com --passin rollback ./
```
That always does the trick for me. |
17724449 | Batch Script to Find a Folder inside Sub Folders and get Folder Path | 7 | 2013-07-18 13:11:13 | <p>I am trying to come up with a batch file that will perform the following:</p>
<ol>
<li>Ask the user to input a name. If no name was given, ask again.</li>
<li>Search all sub folders from a starting point (say C:\Temp) for that name.</li>
<li>If found, I then want to move that found folder and all it's contents to ... | 36,694 | 1,399,110 | 2022-10-27 17:02:23 | 17,736,442 | 15 | 2013-07-19 00:51:56 | 2,299,431 | 2013-07-19 00:51:56 | https://stackoverflow.com/q/17724449 | https://stackoverflow.com/a/17736442 | <pre><code>@echo off
for /d /r "c:\temp" %%a in (*) do if /i "%%~nxa"=="apples" set "folderpath=%%a"
echo "%folderpath%"
</code></pre>
| <pre><code>@echo off for /d /r "c:\temp" %%a in (*) do if /i "%%~nxa"=="apples" set "folderpath=%%a" echo "%folderpath%" </code></pre> | 7002 | batch-file | <h1>Batch Script to Find a Folder inside Sub Folders and get Folder Path</h1>
<p>I am trying to come up with a batch file that will perform the following:</p>
<ol>
<li>Ask the user to input a name. If no name was given, ask again.</li>
<li>Search all sub folders from a starting point (say C:\Temp) for that name.</li>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,272 | cmd | # Batch Script to Find a Folder inside Sub Folders and get Folder Path
I am trying to come up with a batch file that will perform the following:
1. Ask the user to input a name. If no name was given, ask again.
2. Search all sub folders from a starting point (say C:\Temp) for that name.
3. If found, I then want to mo... | ```
@echo off
for /d /r "c:\temp" %%a in (*) do if /i "%%~nxa"=="apples" set "folderpath=%%a"
echo "%folderpath%"
``` |
8532036 | Return control from a batch file | 7 | 2011-12-16 09:17:58 | <p>I have a batch file which has several commands as follows;</p>
<pre><code>XCOPY
DEL
RMDIR
anotherBatch.bat
XCOPY
DEL
RMDIR
</code></pre>
<p>As you can see, in between there is a call to another batch file (anotherBatch.bat), which does some other processing.</p>
<p>Now my question is after anotherBatch gets... | 6,276 | 485,743 | 2011-12-16 11:00:28 | 8,533,215 | 15 | 2011-12-16 11:00:28 | 778,560 | 2011-12-16 11:00:28 | https://stackoverflow.com/q/8532036 | https://stackoverflow.com/a/8533215 | <p>A Batch <em>SUBROUTINE</em> is another Batch file called via CALL command:</p>
<pre><code>CALL subroutineName Param1 Param2
</code></pre>
<p>The subroutine may be placed in the same file of the calling code. This is indicated by preceding its name with colon:</p>
<pre><code>CALL :SubroutineInThisFile Param1 Param... | <p>A Batch <em>SUBROUTINE</em> is another Batch file called via CALL command:</p> <pre><code>CALL subroutineName Param1 Param2 </code></pre> <p>The subroutine may be placed in the same file of the calling code. This is indicated by preceding its name with colon:</p> <pre><code>CALL :SubroutineInThisFile Param1 Param... | 4710, 5370, 7002 | batch-file, dos, xcopy | <h1>Return control from a batch file</h1>
<p>I have a batch file which has several commands as follows;</p>
<pre><code>XCOPY
DEL
RMDIR
anotherBatch.bat
XCOPY
DEL
RMDIR
</code></pre>
<p>As you can see, in between there is a call to another batch file (anotherBatch.bat), which does some other processing.</p>
<p>... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,273 | cmd | # Return control from a batch file
I have a batch file which has several commands as follows;
```
XCOPY
DEL
RMDIR
anotherBatch.bat
XCOPY
DEL
RMDIR
```
As you can see, in between there is a call to another batch file (anotherBatch.bat), which does some other processing.
Now my question is after anotherBatch ge... | A Batch *SUBROUTINE* is another Batch file called via CALL command:
```
CALL subroutineName Param1 Param2
```
The subroutine may be placed in the same file of the calling code. This is indicated by preceding its name with colon:
```
CALL :SubroutineInThisFile Param1 Param2
. . . .
. . . .
. . . .
EXIT /B
:Subroutin... |
3237618 | %CD% variable behaviour differs when right click and use run as admin | 7 | 2010-07-13 13:29:42 | <p>I have a windows cmd file that is making use of the %CD% environment variable to determine the execution directory of the cmd file.</p>
<p>When I run the cmd file from the command line it works correctly, meaning that the %CD% variable contains the working directory. If I double left click the cmd it also works as ... | 19,113 | 50,850 | 2014-04-19 11:29:08 | 3,237,843 | 15 | 2010-07-13 13:53:50 | 147,320 | 2010-07-13 13:53:50 | https://stackoverflow.com/q/3237618 | https://stackoverflow.com/a/3237843 | <p>Trying using <code>%~dp0</code> instead of <code>%cd%</code>... this should give you the directory which contains the batch (NT shell) script was launched from in any case.</p>
| <p>Trying using <code>%~dp0</code> instead of <code>%cd%</code>... this should give you the directory which contains the batch (NT shell) script was launched from in any case.</p> | 64, 2631, 7002 | batch-file, cmd, windows | <h1>%CD% variable behaviour differs when right click and use run as admin</h1>
<p>I have a windows cmd file that is making use of the %CD% environment variable to determine the execution directory of the cmd file.</p>
<p>When I run the cmd file from the command line it works correctly, meaning that the %CD% variable c... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,274 | cmd | # %CD% variable behaviour differs when right click and use run as admin
I have a windows cmd file that is making use of the %CD% environment variable to determine the execution directory of the cmd file.
When I run the cmd file from the command line it works correctly, meaning that the %CD% variable contains the work... | Trying using `%~dp0` instead of `%cd%`... this should give you the directory which contains the batch (NT shell) script was launched from in any case. |
39691547 | Sublime Text 3 subl command not working in Windows 10 | 6 | 2016-09-25 20:31:50 | <p>when I run the subl command, it just pauses for a moment and doesn't give me any feedback as to what happened and doesn't open. I am currently on windows 10 running the latest sublime text 3 build. I already copied my subl.exe from my sublime text 3 directory to my system32 directory. What am I missing? I've tried s... | 9,669 | 4,557,002 | 2021-03-28 11:54:13 | 39,713,501 | 15 | 2016-09-26 22:41:34 | 934,739 | 2016-09-26 22:41:34 | https://stackoverflow.com/q/39691547 | https://stackoverflow.com/a/39713501 | <p>I'm assuming that when you invoke <code>subl.exe</code> via an absolute path then it works.</p>
<pre><code>> "C:\Program Files\Sublime Text 3\subl.exe"
</code></pre>
<p>Assuming the above works, then the location of <code>subl.exe</code> can be added to the system path so that there is no need to specify the ab... | <p>I'm assuming that when you invoke <code>subl.exe</code> via an absolute path then it works.</p> <pre><code>> "C:\Program Files\Sublime Text 3\subl.exe" </code></pre> <p>Assuming the above works, then the location of <code>subl.exe</code> can be added to the system path so that there is no need to specify the ab... | 16, 1231, 2631, 9938, 88190 | cmd, command-line, command-prompt, python, sublimetext3 | <h1>Sublime Text 3 subl command not working in Windows 10</h1>
<p>when I run the subl command, it just pauses for a moment and doesn't give me any feedback as to what happened and doesn't open. I am currently on windows 10 running the latest sublime text 3 build. I already copied my subl.exe from my sublime text 3 dire... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,276 | cmd | # Sublime Text 3 subl command not working in Windows 10
when I run the subl command, it just pauses for a moment and doesn't give me any feedback as to what happened and doesn't open. I am currently on windows 10 running the latest sublime text 3 build. I already copied my subl.exe from my sublime text 3 directory to ... | I'm assuming that when you invoke `subl.exe` via an absolute path then it works.
```
> "C:\Program Files\Sublime Text 3\subl.exe"
```
Assuming the above works, then the location of `subl.exe` can be added to the system path so that there is no need to specify the absolute path.
Go to `Control Panel > System and Secu... |
35844667 | RepositoryItemReader doesn't find methods with arguments | 6 | 2016-03-07 13:11:07 | <p>I'm setting up an ItemRepositoryReader for the reader in a springBatch step.</p>
<pre><code>public ItemReader<EcheanceEntity> reader(){
RepositoryItemReader<EcheanceEntity> reader = new RepositoryItemReader<EcheanceEntity>();
reader.setRepository(echeanceRepository);
reader.setMethodNa... | 16,307 | 6,028,064 | 2020-08-26 23:10:31 | 39,069,801 | 15 | 2016-08-21 23:44:50 | 840,584 | 2020-08-26 23:10:31 | https://stackoverflow.com/q/35844667 | https://stackoverflow.com/a/39069801 | <p>In a case of using the <code>RepositoryItemReader#setMethodName</code> method you need to add an argument of type <code>Pageable</code> in your repository method signature at last position:</p>
<pre class="lang-java prettyprint-override"><code> public interface EcheanceRepository extends JpaRepository<Echeance... | <p>In a case of using the <code>RepositoryItemReader#setMethodName</code> method you need to add an argument of type <code>Pageable</code> in your repository method signature at last position:</p> <pre class="lang-java prettyprint-override"><code> public interface EcheanceRepository extends JpaRepository<Echeance... | 17, 1211, 41895 | java, spring, spring-batch | <h1>RepositoryItemReader doesn't find methods with arguments</h1>
<p>I'm setting up an ItemRepositoryReader for the reader in a springBatch step.</p>
<pre><code>public ItemReader<EcheanceEntity> reader(){
RepositoryItemReader<EcheanceEntity> reader = new RepositoryItemReader<EcheanceEntity>();
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,277 | cmd | # RepositoryItemReader doesn't find methods with arguments
I'm setting up an ItemRepositoryReader for the reader in a springBatch step.
```
public ItemReader<EcheanceEntity> reader(){
RepositoryItemReader<EcheanceEntity> reader = new RepositoryItemReader<EcheanceEntity>();
reader.setRepository(echeanceReposit... | In a case of using the `RepositoryItemReader#setMethodName` method you need to add an argument of type `Pageable` in your repository method signature at last position:
```
public interface EcheanceRepository extends JpaRepository<EcheanceEntity, Long> {
public Page<EcheanceEntity> findById(long id, Pa... |
28806787 | Spring Batch difference between pageSize and commit-interval | 6 | 2015-03-02 09:52:45 | <p>Whats the relationship/difference between Spring-Batch Reader 'pageSize' property and Writer 'commit-interval'.</p>
<p>I may be wrong but I see a pattern in my application that for every pageSize exceeded I get see one commit being made. Is this true.?</p>
<p>Thanks</p>
| 13,237 | 1,784,629 | 2016-08-03 12:09:21 | 28,815,200 | 15 | 2015-03-02 16:51:53 | 618,059 | 2015-03-02 16:51:53 | https://stackoverflow.com/q/28806787 | https://stackoverflow.com/a/28815200 | <p>The <code>commit-interval</code> defines how many items are processed within a single chunk. That number of items are read, processed, then written within the scope of a single transaction (skip/retry semantics not withstanding).</p>
<p>The <code>page-size</code> attribute on the paging <code>ItemReader</code> imp... | <p>The <code>commit-interval</code> defines how many items are processed within a single chunk. That number of items are read, processed, then written within the scope of a single transaction (skip/retry semantics not withstanding).</p> <p>The <code>page-size</code> attribute on the paging <code>ItemReader</code> imp... | 41895 | spring-batch | <h1>Spring Batch difference between pageSize and commit-interval</h1>
<p>Whats the relationship/difference between Spring-Batch Reader 'pageSize' property and Writer 'commit-interval'.</p>
<p>I may be wrong but I see a pattern in my application that for every pageSize exceeded I get see one commit being made. Is this ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,278 | cmd | # Spring Batch difference between pageSize and commit-interval
Whats the relationship/difference between Spring-Batch Reader 'pageSize' property and Writer 'commit-interval'.
I may be wrong but I see a pattern in my application that for every pageSize exceeded I get see one commit being made. Is this true.?
Thanks | The `commit-interval` defines how many items are processed within a single chunk. That number of items are read, processed, then written within the scope of a single transaction (skip/retry semantics not withstanding).
The `page-size` attribute on the paging `ItemReader` implementations (`JdbcPagingItemReader` for exa... |
16193702 | Batch For loop exclude file name that contains | 6 | 2013-04-24 13:47:30 | <p>I have a simple batch file that will loop through all *Test.htm files and copy them. Some of the files will contain a string that I don't want to copy.</p>
<pre><code>FOR /R "C:\" %%g IN (*Test.htm) DO (
echo %%g
)
</code></pre>
<p>What I want in pseudo code:</p>
<pre><code>@echo off
FOR /R "C:\" %%g IN (*Test.... | 12,010 | 1,404,184 | 2019-02-12 13:15:20 | 16,194,407 | 15 | 2013-04-24 14:17:26 | 1,248,295 | 2013-04-24 14:17:26 | https://stackoverflow.com/q/16193702 | https://stackoverflow.com/a/16194407 | <p><strong>For filename:</strong></p>
<pre><code>@echo off
FOR /R "C:\" %%g IN (*Test.htm) DO (
(Echo "%%g" | FIND /I "Exclude" 1>NUL) || (
Copy "%%g"...
)
)
</code></pre>
<p><strong>For File content:</strong></p>
<pre><code>@echo off
FOR /R "C:\" %%g IN (*Test.htm) DO (
(Type "%%g" | FIND /I ... | <p><strong>For filename:</strong></p> <pre><code>@echo off FOR /R "C:\" %%g IN (*Test.htm) DO ( (Echo "%%g" | FIND /I "Exclude" 1>NUL) || ( Copy "%%g"... ) ) </code></pre> <p><strong>For File content:</strong></p> <pre><code>@echo off FOR /R "C:\" %%g IN (*Test.htm) DO ( (Type "%%g" | FIND /I ... | 7002 | batch-file | <h1>Batch For loop exclude file name that contains</h1>
<p>I have a simple batch file that will loop through all *Test.htm files and copy them. Some of the files will contain a string that I don't want to copy.</p>
<pre><code>FOR /R "C:\" %%g IN (*Test.htm) DO (
echo %%g
)
</code></pre>
<p>What I want in pseudo cod... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,279 | cmd | # Batch For loop exclude file name that contains
I have a simple batch file that will loop through all *Test.htm files and copy them. Some of the files will contain a string that I don't want to copy.
```
FOR /R "C:\" %%g IN (*Test.htm) DO (
echo %%g
)
```
What I want in pseudo code:
```
@echo off
FOR /R "C:\" %%g... | **For filename:**
```
@echo off
FOR /R "C:\" %%g IN (*Test.htm) DO (
(Echo "%%g" | FIND /I "Exclude" 1>NUL) || (
Copy "%%g"...
)
)
```
**For File content:**
```
@echo off
FOR /R "C:\" %%g IN (*Test.htm) DO (
(Type "%%g" | FIND /I "Exclude" 1>NUL) || (
Copy "%%g"...
)
)
``` |
11379242 | Display the contents of a .txt in a batch file? | 6 | 2012-07-07 22:42:51 | <p>I am working on a batch file right now and I have everything done that I need but I'm stuck at one point. One of the programs I use spits out a log file and I have it place this file on the C:drive in a folder. What I want to do is have it read this .txt and spit that back into the batch file as an echo.</p>
| 11,008 | 1,509,339 | 2012-07-08 13:08:46 | 11,379,286 | 15 | 2012-07-07 22:53:23 | 1,509,341 | 2012-07-08 13:08:46 | https://stackoverflow.com/q/11379242 | https://stackoverflow.com/a/11379286 | <p>You can put this in your batch file:</p>
<pre><code>type C:\folder\test.txt
</code></pre>
<p>This will echo out the contents of test.txt.</p>
| <p>You can put this in your batch file:</p> <pre><code>type C:\folder\test.txt </code></pre> <p>This will echo out the contents of test.txt.</p> | 7002 | batch-file | <h1>Display the contents of a .txt in a batch file?</h1>
<p>I am working on a batch file right now and I have everything done that I need but I'm stuck at one point. One of the programs I use spits out a log file and I have it place this file on the C:drive in a folder. What I want to do is have it read this .txt and s... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,280 | cmd | # Display the contents of a .txt in a batch file?
I am working on a batch file right now and I have everything done that I need but I'm stuck at one point. One of the programs I use spits out a log file and I have it place this file on the C:drive in a folder. What I want to do is have it read this .txt and spit that ... | You can put this in your batch file:
```
type C:\folder\test.txt
```
This will echo out the contents of test.txt. |
6873075 | ImageMagick mogrify doesn't work | 6 | 2011-07-29 12:29:24 | <p>This works:</p>
<pre><code>convert 005_R.JPG -fuzz 20% -fill white -opaque "#eceaeb" 005_R_magic.JPG
</code></pre>
<p>.. but this doesn't:</p>
<pre><code>mogrify * -fuzz 20% -fill white -opaque "#eceaeb"
</code></pre>
<p>what am I doing wrong here?</p>
<p>Thanks!</p>
| 2,498 | 172,637 | 2011-07-29 12:31:53 | 6,873,111 | 15 | 2011-07-29 12:31:53 | 73,070 | 2011-07-29 12:31:53 | https://stackoverflow.com/q/6873075 | https://stackoverflow.com/a/6873111 | <p>Put the file names to process at the end:</p>
<pre><code>mogrify -fuzz 20% -fill white -opaque "#eceaeb" *
</code></pre>
| <p>Put the file names to process at the end:</p> <pre><code>mogrify -fuzz 20% -fill white -opaque "#eceaeb" * </code></pre> | 6554, 7002, 59661 | batch-file, imagemagick, mogrify | <h1>ImageMagick mogrify doesn't work</h1>
<p>This works:</p>
<pre><code>convert 005_R.JPG -fuzz 20% -fill white -opaque "#eceaeb" 005_R_magic.JPG
</code></pre>
<p>.. but this doesn't:</p>
<pre><code>mogrify * -fuzz 20% -fill white -opaque "#eceaeb"
</code></pre>
<p>what am I doing wrong here?</p>
<p>Thanks!</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,282 | cmd | # ImageMagick mogrify doesn't work
This works:
```
convert 005_R.JPG -fuzz 20% -fill white -opaque "#eceaeb" 005_R_magic.JPG
```
.. but this doesn't:
```
mogrify * -fuzz 20% -fill white -opaque "#eceaeb"
```
what am I doing wrong here?
Thanks! | Put the file names to process at the end:
```
mogrify -fuzz 20% -fill white -opaque "#eceaeb" *
``` |
2916758 | Running a batch file with parameters in Python OR F# | 6 | 2010-05-26 20:58:16 | <p>I searched the site, but I didn't see anything quite matching what I was looking for. I created a stand-alone application that uses a web service I created. To run the client I use:</p>
<pre><code>C:/scriptsdirecotry> "run-client.bat" param1 param2 param3 param4
</code></pre>
<p>How would I go about coding this... | 33,648 | 226,473 | 2016-11-12 01:53:02 | 2,917,778 | 15 | 2010-05-27 00:33:32 | 17,919 | 2010-05-28 00:58:28 | https://stackoverflow.com/q/2916758 | https://stackoverflow.com/a/2917778 | <p>Python is similar.</p>
<pre><code>import os
os.system("run-client.bat param1 param2")
</code></pre>
<p>If you need asynchronous behavior or redirected standard streams.</p>
<pre><code>from subprocess import *
p = Popen(['run-client.bat', param1, param2], stdout=PIPE, stderr=PIPE)
output, errors = p.communicate()
... | <p>Python is similar.</p> <pre><code>import os os.system("run-client.bat param1 param2") </code></pre> <p>If you need asynchronous behavior or redirected standard streams.</p> <pre><code>from subprocess import * p = Popen(['run-client.bat', param1, param2], stdout=PIPE, stderr=PIPE) output, errors = p.communicate() ... | 16, 64, 1198, 2579, 7002 | batch-file, f#, python, web-services, windows | <h1>Running a batch file with parameters in Python OR F#</h1>
<p>I searched the site, but I didn't see anything quite matching what I was looking for. I created a stand-alone application that uses a web service I created. To run the client I use:</p>
<pre><code>C:/scriptsdirecotry> "run-client.bat" param1 param2 pa... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,283 | cmd | # Running a batch file with parameters in Python OR F#
I searched the site, but I didn't see anything quite matching what I was looking for. I created a stand-alone application that uses a web service I created. To run the client I use:
```
C:/scriptsdirecotry> "run-client.bat" param1 param2 param3 param4
```
How wo... | Python is similar.
```
import os
os.system("run-client.bat param1 param2")
```
If you need asynchronous behavior or redirected standard streams.
```
from subprocess import *
p = Popen(['run-client.bat', param1, param2], stdout=PIPE, stderr=PIPE)
output, errors = p.communicate()
p.wait() # wait for process to termina... |
2693740 | How to use mkdir and rmdir commands in a java program | 6 | 2010-04-22 19:16:33 | <p>I want to use system commands like <code>mkdir</code> and <code>rmdir</code> while running a java program.</p>
<p>How can I do that?</p>
| 22,599 | 312,081 | 2021-07-06 06:58:45 | 2,693,754 | 15 | 2010-04-22 19:18:50 | 87,197 | 2010-04-23 03:09:15 | https://stackoverflow.com/q/2693740 | https://stackoverflow.com/a/2693754 | <p>Why do you want to use the command line? FYI, there are built-in platform-independent <code>File</code> classes.</p>
<p><a href="http://www.exampledepot.com/egs/java.io/deletefile.html" rel="noreferrer">http://www.exampledepot.com/egs/java.io/deletefile.html</a><br />
<a href="http://www.roseindia.net/java/beginner... | <p>Why do you want to use the command line? FYI, there are built-in platform-independent <code>File</code> classes.</p> <p><a href="http://www.exampledepot.com/egs/java.io/deletefile.html" rel="noreferrer">http://www.exampledepot.com/egs/java.io/deletefile.html</a><br /> <a href="http://www.roseindia.net/java/beginner... | 17, 1231, 2631 | cmd, command-line, java | <h1>How to use mkdir and rmdir commands in a java program</h1>
<p>I want to use system commands like <code>mkdir</code> and <code>rmdir</code> while running a java program.</p>
<p>How can I do that?</p>
| q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,284 | cmd | # How to use mkdir and rmdir commands in a java program
I want to use system commands like `mkdir` and `rmdir` while running a java program.
How can I do that? | Why do you want to use the command line? FYI, there are built-in platform-independent `File` classes.
<http://www.exampledepot.com/egs/java.io/deletefile.html>
<http://www.roseindia.net/java/beginners/java-create-directory.shtml>
Make directory:
```
new File("dir path").mkdir();
```
Remove directory:
```
new Fil... |
2434125 | Run bat file in Java and wait | 6 | 2010-03-12 16:27:45 | <p>You would think that launching a bat file from Java would be an easy task but no... I have a bat file that does some sql commands for a loop of values read from a text file. It is more or less like this:</p>
<pre><code>FOR /F %%x in (%CD%\listOfThings.txt) do sqlcmd -Slocalhost\MSSQL %1 %2 -d %3 -i %CD%\SQLScripts\... | 11,470 | 56,242 | 2017-02-08 02:57:27 | 2,434,144 | 15 | 2010-03-12 16:30:25 | 13,531 | 2010-03-12 16:30:25 | https://stackoverflow.com/q/2434125 | https://stackoverflow.com/a/2434144 | <p>You should not ignore the return value of <a href="http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String[])" rel="noreferrer"><code>.exec()</code></a>. It gives you a <a href="http://java.sun.com/javase/6/docs/api/java/lang/Process.html" rel="noreferrer"><code>Process</code></a> object t... | <p>You should not ignore the return value of <a href="http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String[])" rel="noreferrer"><code>.exec()</code></a>. It gives you a <a href="http://java.sun.com/javase/6/docs/api/java/lang/Process.html" rel="noreferrer"><code>Process</code></a> object t... | 17, 7002, 7932 | batch-file, exec, java | <h1>Run bat file in Java and wait</h1>
<p>You would think that launching a bat file from Java would be an easy task but no... I have a bat file that does some sql commands for a loop of values read from a text file. It is more or less like this:</p>
<pre><code>FOR /F %%x in (%CD%\listOfThings.txt) do sqlcmd -Slocalhos... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,285 | cmd | # Run bat file in Java and wait
You would think that launching a bat file from Java would be an easy task but no... I have a bat file that does some sql commands for a loop of values read from a text file. It is more or less like this:
```
FOR /F %%x in (%CD%\listOfThings.txt) do sqlcmd -Slocalhost\MSSQL %1 %2 -d %3 ... | You should not ignore the return value of [`.exec()`](http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#exec(java.lang.String[])). It gives you a [`Process`](http://java.sun.com/javase/6/docs/api/java/lang/Process.html) object that you can [`waitFor()`](http://java.sun.com/javase/6/docs/api/java/lang/Process... |
19835849 | Batch-Script - Iterate through arguments | 48 | 2013-11-07 12:22:49 | <p>I have a batch-script with multiple arguments. I am reading the total count of them and then run a for loop like this:</p>
<pre><code>@echo off
setlocal enabledelayedexpansion
set argCount=0
for %%x in (%*) do set /A argCount+=1
echo Number of processed arguments: %argCount%
set /a counter=0
for /l %%x in (1, 1, ... | 73,504 | 878,936 | 2021-07-23 17:45:47 | 19,836,315 | 14 | 2013-11-07 12:43:26 | 388,389 | 2021-07-23 17:45:47 | https://stackoverflow.com/q/19835849 | https://stackoverflow.com/a/19836315 | <p>here's one way to access the second (e.g.) argument (this can be put in a <code>for /l</code> loop, see below.):</p>
<pre><code>@echo off
setlocal enableDelayedExpansion
set /a counter=2
call echo %%!counter!
endlocal
</code></pre>
<p>so:</p>
<pre><code>setlocal enableDelayedExpansion
set /a counter=0
for /l %%x in ... | <p>here's one way to access the second (e.g.) argument (this can be put in a <code>for /l</code> loop, see below.):</p> <pre><code>@echo off setlocal enableDelayedExpansion set /a counter=2 call echo %%!counter! endlocal </code></pre> <p>so:</p> <pre><code>setlocal enableDelayedExpansion set /a counter=0 for /l %%x in ... | 2313, 2314, 7002, 31134 | arguments, batch-file, command-line-arguments, loops | <h1>Batch-Script - Iterate through arguments</h1>
<p>I have a batch-script with multiple arguments. I am reading the total count of them and then run a for loop like this:</p>
<pre><code>@echo off
setlocal enabledelayedexpansion
set argCount=0
for %%x in (%*) do set /A argCount+=1
echo Number of processed arguments: ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,286 | cmd | # Batch-Script - Iterate through arguments
I have a batch-script with multiple arguments. I am reading the total count of them and then run a for loop like this:
```
@echo off
setlocal enabledelayedexpansion
set argCount=0
for %%x in (%*) do set /A argCount+=1
echo Number of processed arguments: %argCount%
set /a c... | here's one way to access the second (e.g.) argument (this can be put in a `for /l` loop, see below.):
```
@echo off
setlocal enableDelayedExpansion
set /a counter=2
call echo %%!counter!
endlocal
```
so:
```
setlocal enableDelayedExpansion
set /a counter=0
for /l %%x in (1, 1, %argCount%) do (
set /a counter=!count... |
13469939 | Replacing Characters in String | 26 | 2012-11-20 09:17:22 | <p>I am trying to replace all instances of a character in a string of text with another character but I'm not succeeding.</p>
<p>Suppose the text is</p>
<pre><code>cat rat mat fat
</code></pre>
<p>I want the script to replace all the <code>t's to p's</code></p>
<pre><code>cap rap map fap
</code></pre>
<p>What I ha... | 56,313 | 992,947 | 2017-05-12 08:59:16 | 13,470,115 | 14 | 2012-11-20 09:28:35 | 204,690 | 2012-11-20 09:39:22 | https://stackoverflow.com/q/13469939 | https://stackoverflow.com/a/13470115 | <p>You've got the <code>=</code> sign in the wrong place. Try:</p>
<pre><code>setlocal enabledelayedexpansion
set /P MY_TEXT=ENTER TEXT:
SET T2P=P
set NEW_TEXT=%MY_TEXT:T=!T2P!%
MSG * %NEW_TEXT%
</code></pre>
<p>You can also do the expansion the other way round, i.e.</p>
<pre><code>set NEW_TEXT=!MY_TEXT:T=%T2P%!
</c... | <p>You've got the <code>=</code> sign in the wrong place. Try:</p> <pre><code>setlocal enabledelayedexpansion set /P MY_TEXT=ENTER TEXT: SET T2P=P set NEW_TEXT=%MY_TEXT:T=!T2P!% MSG * %NEW_TEXT% </code></pre> <p>You can also do the expansion the other way round, i.e.</p> <pre><code>set NEW_TEXT=!MY_TEXT:T=%T2P%! </c... | 64, 139, 6067, 7002 | batch-file, character, string, windows | <h1>Replacing Characters in String</h1>
<p>I am trying to replace all instances of a character in a string of text with another character but I'm not succeeding.</p>
<p>Suppose the text is</p>
<pre><code>cat rat mat fat
</code></pre>
<p>I want the script to replace all the <code>t's to p's</code></p>
<pre><code>cap... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,288 | cmd | # Replacing Characters in String
I am trying to replace all instances of a character in a string of text with another character but I'm not succeeding.
Suppose the text is
```
cat rat mat fat
```
I want the script to replace all the `t's to p's`
```
cap rap map fap
```
What I have is the following but it seems to... | You've got the `=` sign in the wrong place. Try:
```
setlocal enabledelayedexpansion
set /P MY_TEXT=ENTER TEXT:
SET T2P=P
set NEW_TEXT=%MY_TEXT:T=!T2P!%
MSG * %NEW_TEXT%
```
You can also do the expansion the other way round, i.e.
```
set NEW_TEXT=!MY_TEXT:T=%T2P%!
``` |
16276336 | Removing spaces from a variable in batch | 22 | 2013-04-29 10:26:06 | <p>I am writing a file to remove spaces from filenames in a folder and then put the result in a <code>.txt</code> file. I just get a result of "Echo is on." over and over. </p>
<p>This is what I have so far:</p>
<pre><code>@echo ON
SET LOCAL EnableDelayedExpansion
For %%# in (*.*) do (
SET var=%%~n#
Set My... | 128,066 | 2,313,522 | 2022-08-27 09:50:50 | 16,276,543 | 14 | 2013-04-29 10:37:29 | 2,033,427 | 2013-04-29 10:43:10 | https://stackoverflow.com/q/16276336 | https://stackoverflow.com/a/16276543 | <p>The reason why you are getting <code>ECHO is on.</code> is because delayed expansion was not used, which caused the value of <code>%var%</code> and <code>%MyVar%</code> to be inserted before the <code>for</code> command is run, and since they were not defined at the start, empty variables were inserted in. When the ... | <p>The reason why you are getting <code>ECHO is on.</code> is because delayed expansion was not used, which caused the value of <code>%var%</code> and <code>%MyVar%</code> to be inserted before the <code>for</code> command is run, and since they were not defined at the start, empty variables were inserted in. When the ... | 276, 5162, 7002 | batch-file, spaces, variables | <h1>Removing spaces from a variable in batch</h1>
<p>I am writing a file to remove spaces from filenames in a folder and then put the result in a <code>.txt</code> file. I just get a result of "Echo is on." over and over. </p>
<p>This is what I have so far:</p>
<pre><code>@echo ON
SET LOCAL EnableDelayedExpansion
... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,289 | cmd | # Removing spaces from a variable in batch
I am writing a file to remove spaces from filenames in a folder and then put the result in a `.txt` file. I just get a result of "Echo is on." over and over.
This is what I have so far:
```
@echo ON
SET LOCAL EnableDelayedExpansion
For %%# in (*.*) do (
SET var=%%~n#
... | The reason why you are getting `ECHO is on.` is because delayed expansion was not used, which caused the value of `%var%` and `%MyVar%` to be inserted before the `for` command is run, and since they were not defined at the start, empty variables were inserted in. When the `echo %MyVar%>>text.txt` was run, it was interp... |
1536205 | Running another program in Windows bat file and not create child process | 21 | 2009-10-08 07:40:03 | <p>I have subversion server with a post-commit hook to do something.</p>
<p>I want the checkin finish soon, not wait the hook script.
But by design, the Subversion post-commit hook script will run until all <strong>child</strong> process exit, so using somthing like:</p>
<p>start another_prog...</p>
<p>in the hook ... | 56,402 | 47,936 | 2019-07-22 20:23:21 | 1,582,197 | 14 | 2009-10-17 13:20:44 | 47,936 | 2009-10-17 13:20:44 | https://stackoverflow.com/q/1536205 | https://stackoverflow.com/a/1582197 | <p>I found a method to resolve my question, compile the following c code and named the exe output as runjob.exe, and then in the hook bat file, use " runjob another_prog " , now it's ok.</p>
<pre><code>#include <windows.h>
#include <stdio.h>
#include <tchar.h>
int _tmain()
{
char * pCmd = ::... | <p>I found a method to resolve my question, compile the following c code and named the exe output as runjob.exe, and then in the hook bat file, use " runjob another_prog " , now it's ok.</p> <pre><code>#include <windows.h> #include <stdio.h> #include <tchar.h> int _tmain() { char * pCmd = ::... | 63, 64, 7002, 10250, 64649 | batch-file, post-commit, svn, svn-hooks, windows | <h1>Running another program in Windows bat file and not create child process</h1>
<p>I have subversion server with a post-commit hook to do something.</p>
<p>I want the checkin finish soon, not wait the hook script.
But by design, the Subversion post-commit hook script will run until all <strong>child</strong> proces... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,290 | cmd | # Running another program in Windows bat file and not create child process
I have subversion server with a post-commit hook to do something.
I want the checkin finish soon, not wait the hook script.
But by design, the Subversion post-commit hook script will run until all **child** process exit, so using somthing like... | I found a method to resolve my question, compile the following c code and named the exe output as runjob.exe, and then in the hook bat file, use " runjob another_prog " , now it's ok.
```
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
int _tmain()
{
char * pCmd = ::GetCommandLine();
// skip t... |
23550814 | BAT file to map to network drive without running as admin | 20 | 2014-05-08 19:27:05 | <p>I'm trying to create a .bat file that will map to a network drive when it is clicked (it would be even better if it could connect automatically on login if connected to the network, otherwise do not connect)</p>
<p>What I have so far is:</p>
<pre><code>net use P: "\\server\foldername\foldername"
</code></pre>
<p>... | 373,074 | 2,524,749 | 2019-04-22 11:44:20 | 23,551,646 | 14 | 2014-05-08 20:15:26 | 2,524,749 | 2014-05-08 20:15:26 | https://stackoverflow.com/q/23550814 | https://stackoverflow.com/a/23551646 | <p>I just figured it out! What I did was I created the batch file like I had it originally:</p>
<pre><code>net use P: "\\server\foldername\foldername"
</code></pre>
<p>I then saved it to the desktop and right clicked the properties and checked run as administrator. I then copied the file to C:\Users\"TheUser"\AppData... | <p>I just figured it out! What I did was I created the batch file like I had it originally:</p> <pre><code>net use P: "\\server\foldername\foldername" </code></pre> <p>I then saved it to the desktop and right clicked the properties and checked run as administrator. I then copied the file to C:\Users\"TheUser"\AppData... | 64, 7002, 9056 | batch-file, drive, windows | <h1>BAT file to map to network drive without running as admin</h1>
<p>I'm trying to create a .bat file that will map to a network drive when it is clicked (it would be even better if it could connect automatically on login if connected to the network, otherwise do not connect)</p>
<p>What I have so far is:</p>
<pre><... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,291 | cmd | # BAT file to map to network drive without running as admin
I'm trying to create a .bat file that will map to a network drive when it is clicked (it would be even better if it could connect automatically on login if connected to the network, otherwise do not connect)
What I have so far is:
```
net use P: "\\server\f... | I just figured it out! What I did was I created the batch file like I had it originally:
```
net use P: "\\server\foldername\foldername"
```
I then saved it to the desktop and right clicked the properties and checked run as administrator. I then copied the file to C:\Users\"TheUser"\AppData\Roaming\Microsoft\Windows\... |
21304364 | Spring batch Job read from multiple sources | 18 | 2014-01-23 09:38:59 | <p>How can I read items from multiples databases? I already know that is possible from files.<br>
the following example works for read from multiples files</p>
<pre><code>...
<job id="readMultiFileJob" xmlns="http://www.springframework.org/schema/batch">
<step id="step1">
<tasklet>
&l... | 21,544 | 2,799,389 | 2016-09-15 06:19:10 | 21,304,893 | 14 | 2014-01-23 10:03:57 | 2,587,166 | 2016-09-15 06:19:10 | https://stackoverflow.com/q/21304364 | https://stackoverflow.com/a/21304893 | <p>There isn't a ready-to-use component that perform what you ask; the only solution is to write a custom <code>ItemReader<></code> that delegates to <code>JdbcCursorItemReader</code> (or to <code>HibernateCursorItemReader</code> or to any generic <code>ItemReader</code> implementation).<br/>
You need to prepare ... | <p>There isn't a ready-to-use component that perform what you ask; the only solution is to write a custom <code>ItemReader<></code> that delegates to <code>JdbcCursorItemReader</code> (or to <code>HibernateCursorItemReader</code> or to any generic <code>ItemReader</code> implementation).<br/> You need to prepare ... | 17, 30, 1211, 41895 | database, java, spring, spring-batch | <h1>Spring batch Job read from multiple sources</h1>
<p>How can I read items from multiples databases? I already know that is possible from files.<br>
the following example works for read from multiples files</p>
<pre><code>...
<job id="readMultiFileJob" xmlns="http://www.springframework.org/schema/batch">
&... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,292 | cmd | # Spring batch Job read from multiple sources
How can I read items from multiples databases? I already know that is possible from files.
the following example works for read from multiples files
```
...
<job id="readMultiFileJob" xmlns="http://www.springframework.org/schema/batch">
<step id="step1">
<taskle... | There isn't a ready-to-use component that perform what you ask; the only solution is to write a custom `ItemReader<>` that delegates to `JdbcCursorItemReader` (or to `HibernateCursorItemReader` or to any generic `ItemReader` implementation).
You need to prepare all necessary stuff (datasource, session, real database ... |
377407 | Detecting how a batch file was executed | 18 | 2008-12-18 09:58:05 | <p>Assuming Windows, is there a way I can detect from within a batch file if it was launched from an open command prompt or by double-clicking? I'd like to add a pause to the end of the batch process if and only if it was double clicked, so that the window doesn't just disappear along with any useful output it may hav... | 6,623 | 33,346 | 2019-01-16 13:35:28 | 377,933 | 14 | 2008-12-18 14:06:11 | 7,903 | 2008-12-18 14:15:56 | https://stackoverflow.com/q/377407 | https://stackoverflow.com/a/377933 | <p>I just ran a quick test and noticed the following, which may help you:</p>
<ul>
<li>When run from an open command prompt, the %0 variable does not have double quotes around the path. If the script resides in the current directory, the path isn't even given, just the batch file name.</li>
<li>When run from explorer,... | <p>I just ran a quick test and noticed the following, which may help you:</p> <ul> <li>When run from an open command prompt, the %0 variable does not have double quotes around the path. If the script resides in the current directory, the path isn't even given, just the batch file name.</li> <li>When run from explorer,... | 64, 7002 | batch-file, windows | <h1>Detecting how a batch file was executed</h1>
<p>Assuming Windows, is there a way I can detect from within a batch file if it was launched from an open command prompt or by double-clicking? I'd like to add a pause to the end of the batch process if and only if it was double clicked, so that the window doesn't just ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,294 | cmd | # Detecting how a batch file was executed
Assuming Windows, is there a way I can detect from within a batch file if it was launched from an open command prompt or by double-clicking? I'd like to add a pause to the end of the batch process if and only if it was double clicked, so that the window doesn't just disappear ... | I just ran a quick test and noticed the following, which may help you:
- When run from an open command prompt, the %0 variable does not have double quotes around the path. If the script resides in the current directory, the path isn't even given, just the batch file name.
- When run from explorer, the %0 variable is a... |
42211476 | What does "2>&1" in a Windows Command Do? | 16 | 2017-02-13 18:56:51 | <p>Doing some maintenance on a script, I found this line:</p>
<pre><code>ping -n 40 127.0.0.1 > NUL 2>&1
</code></pre>
<p>I know <a href="https://stackoverflow.com/questions/1672338/how-to-sleep-for-5-seconds-in-windowss-command-prompt-or-dos">from this question</a> that everything up to the NUL causes the ... | 42,911 | 2,023,861 | 2022-08-23 12:36:36 | 42,211,853 | 14 | 2017-02-13 19:19:17 | 2,861,476 | 2017-02-13 19:19:17 | https://stackoverflow.com/q/42211476 | https://stackoverflow.com/a/42211853 | <p>Decomposing the line</p>
<pre><code>ping -n 40 127.0.0.1
</code></pre>
<p>Send 40 ping packets to local host. If there is not any problem the default behaviour is to wait 1 second between packets, so it generates a 39 second delay </p>
<pre><code>>nul or 1>nul
</code></pre>
<p>Redirects anything writte... | <p>Decomposing the line</p> <pre><code>ping -n 40 127.0.0.1 </code></pre> <p>Send 40 ping packets to local host. If there is not any problem the default behaviour is to wait 1 second between packets, so it generates a 39 second delay </p> <pre><code>>nul or 1>nul </code></pre> <p>Redirects anything writte... | 64, 2221, 2631, 5649, 26698 | cmd, io-redirection, ping, sleep, windows | <h1>What does "2>&1" in a Windows Command Do?</h1>
<p>Doing some maintenance on a script, I found this line:</p>
<pre><code>ping -n 40 127.0.0.1 > NUL 2>&1
</code></pre>
<p>I know <a href="https://stackoverflow.com/questions/1672338/how-to-sleep-for-5-seconds-in-windowss-command-prompt-or-dos">from this que... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,295 | cmd | # What does "2>&1" in a Windows Command Do?
Doing some maintenance on a script, I found this line:
```
ping -n 40 127.0.0.1 > NUL 2>&1
```
I know [from this question](https://stackoverflow.com/questions/1672338/how-to-sleep-for-5-seconds-in-windowss-command-prompt-or-dos) that everything up to the NUL causes the scr... | Decomposing the line
```
ping -n 40 127.0.0.1
```
Send 40 ping packets to local host. If there is not any problem the default behaviour is to wait 1 second between packets, so it generates a 39 second delay
```
>nul or 1>nul
```
Redirects anything written to the standard output stream (stream number 1) to the `... |
28111334 | Node JS, detect production environment | 15 | 2015-01-23 13:47:46 | <p>When I'm in dev mode I don't want my server to send email and some other stuff so I have this in server.js file:</p>
<pre><code>process.env.NODE_ENV = 'development';
</code></pre>
<p>When I move it to production i change the value to 'production'.</p>
<p>Problem is of course that it is easy to forget on deploymen... | 17,234 | 1,572,526 | 2019-10-30 12:37:30 | 46,442,141 | 14 | 2017-09-27 07:42:41 | 1,056,679 | 2017-09-27 08:02:32 | https://stackoverflow.com/q/28111334 | https://stackoverflow.com/a/46442141 | <p>You shouldn't manually change values of <code>process.env</code> object, because this object is reflecting your execution environment.</p>
<p>In your code you should do the following:</p>
<pre><code>const environment = process.env.NODE_ENV || 'development';
</code></pre>
<p>And then you launch your app in product... | <p>You shouldn't manually change values of <code>process.env</code> object, because this object is reflecting your execution environment.</p> <p>In your code you should do the following:</p> <pre><code>const environment = process.env.NODE_ENV || 'development'; </code></pre> <p>And then you launch your app in product... | 7002, 46426 | batch-file, node.js | <h1>Node JS, detect production environment</h1>
<p>When I'm in dev mode I don't want my server to send email and some other stuff so I have this in server.js file:</p>
<pre><code>process.env.NODE_ENV = 'development';
</code></pre>
<p>When I move it to production i change the value to 'production'.</p>
<p>Problem is ... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,296 | cmd | # Node JS, detect production environment
When I'm in dev mode I don't want my server to send email and some other stuff so I have this in server.js file:
```
process.env.NODE_ENV = 'development';
```
When I move it to production i change the value to 'production'.
Problem is of course that it is easy to forget on d... | You shouldn't manually change values of `process.env` object, because this object is reflecting your execution environment.
In your code you should do the following:
```
const environment = process.env.NODE_ENV || 'development';
```
And then you launch your app in production like this:
```
$ NODE_ENV=production nod... |
34880453 | How to execute postgres' sql queries from batch file? | 15 | 2016-01-19 15:18:02 | <p>I need to execute SQL from batch file.
I am executing following to connect to Postgres and select data from table </p>
<pre><code>C:/pgsql/bin/psql -h %DB_HOST% -p 5432 -U %DB_USER% -d %DB_NAME%
select * from test;
</code></pre>
<p>I am able to connect to database, however I'm getting the error</p>
<blockquote>
... | 56,220 | 5,691,018 | 2020-06-09 21:13:37 | 34,881,135 | 14 | 2016-01-19 15:51:02 | 463,115 | 2016-01-20 09:07:16 | https://stackoverflow.com/q/34880453 | https://stackoverflow.com/a/34881135 | <p>You could pipe it into psql</p>
<pre><code>(
echo select * from test;
) | C:/pgsql/bin/psql -h %DB_HOST% -p 5432 -U %DB_USER% -d %DB_NAME%
</code></pre>
<p>When closing parenthesis are part of the SQL query they have to be escaped with three carets.</p>
<pre><code>(
echo insert into testconfig(testid,scenarioid... | <p>You could pipe it into psql</p> <pre><code>( echo select * from test; ) | C:/pgsql/bin/psql -h %DB_HOST% -p 5432 -U %DB_USER% -d %DB_NAME% </code></pre> <p>When closing parenthesis are part of the SQL query they have to be escaped with three carets.</p> <pre><code>( echo insert into testconfig(testid,scenarioid... | 22, 256, 7002, 9938 | batch-file, command-prompt, postgresql, sql | <h1>How to execute postgres' sql queries from batch file?</h1>
<p>I need to execute SQL from batch file.
I am executing following to connect to Postgres and select data from table </p>
<pre><code>C:/pgsql/bin/psql -h %DB_HOST% -p 5432 -U %DB_USER% -d %DB_NAME%
select * from test;
</code></pre>
<p>I am able to connec... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,297 | cmd | # How to execute postgres' sql queries from batch file?
I need to execute SQL from batch file.
I am executing following to connect to Postgres and select data from table
```
C:/pgsql/bin/psql -h %DB_HOST% -p 5432 -U %DB_USER% -d %DB_NAME%
select * from test;
```
I am able to connect to database, however I'm getting... | You could pipe it into psql
```
(
echo select * from test;
) | C:/pgsql/bin/psql -h %DB_HOST% -p 5432 -U %DB_USER% -d %DB_NAME%
```
When closing parenthesis are part of the SQL query they have to be escaped with three carets.
```
(
echo insert into testconfig(testid,scenarioid,testname ^^^) values( 1,1,'asdf'^^^);
... |
26386697 | Why is no string output with 'echo %var%' after using 'set var = text' command in cmd? | 15 | 2014-10-15 15:45:43 |
<p>I set a variable in cmd with the <code>set</code> command, and tried to <code>echo</code> it.</p>
<p>Here is an example:</p>
<pre class="lang-bat prettyprint-override"><code>C:\Users\Logan>set var = text
C:\Users\Logan>set var
var = text
C:\Users\Logan>echo %var%
%var%
C:\Users\Logan>
</code></pre... | 22,653 | null | 2022-05-05 16:52:31 | 26,386,854 | 14 | 2014-10-15 15:53:23 | 4,144,640 | 2022-05-05 16:52:31 | https://stackoverflow.com/q/26386697 | https://stackoverflow.com/a/26386854 | <p>You need to remove whitespace before and after <code>=</code>:</p>
<pre><code>set "var=text"
echo %var%
text
</code></pre>
| <p>You need to remove whitespace before and after <code>=</code>:</p> <pre><code>set "var=text" echo %var% text </code></pre> | 2631, 7002, 9013 | batch-file, cmd, environment-variables | <h1>Why is no string output with 'echo %var%' after using 'set var = text' command in cmd?</h1>
<p>I set a variable in cmd with the <code>set</code> command, and tried to <code>echo</code> it.</p>
<p>Here is an example:</p>
<pre class="lang-bat prettyprint-override"><code>C:\Users\Logan>set var = text
C:\Users\... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,298 | cmd | # Why is no string output with 'echo %var%' after using 'set var = text' command in cmd?
I set a variable in cmd with the `set` command, and tried to `echo` it.
Here is an example:
```
C:\Users\Logan>set var = text
C:\Users\Logan>set var
var = text
C:\Users\Logan>echo %var%
%var%
C:\Users\Logan>
```
Is there a w... | You need to remove whitespace before and after `=`:
```
set "var=text"
echo %var%
text
``` |
25738066 | How to run msi installer in cmd as admin using C# | 15 | 2014-09-09 06:37:23 | <p>I have an msi installer that I need to install it silently from the C#</p>
<pre><code>Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.WorkingDirectory = @"C:\temp\";
process.StartInfo.Arguments = "msiexec /quiet /i Setup.msi ADDLOCAL=test";
process.StartInfo.Verb = "runas"... | 15,838 | 3,040,777 | 2016-12-12 07:24:45 | 25,751,783 | 14 | 2014-09-09 18:57:44 | 3,040,777 | 2014-09-09 18:57:44 | https://stackoverflow.com/q/25738066 | https://stackoverflow.com/a/25751783 | <p>as V2Solutions - MS Team mentioned , the solution is to change the following</p>
<pre><code>process.StartInfo.FileName = "msiexe.exe"
</code></pre>
<p>and the code will be</p>
<pre><code>Process process = new Process();
process.StartInfo.FileName = "msiexec";
process.StartInfo.WorkingDirectory = @"C:\temp\";
pro... | <p>as V2Solutions - MS Team mentioned , the solution is to change the following</p> <pre><code>process.StartInfo.FileName = "msiexe.exe" </code></pre> <p>and the code will be</p> <pre><code>Process process = new Process(); process.StartInfo.FileName = "msiexec"; process.StartInfo.WorkingDirectory = @"C:\temp\"; pro... | 9, 2631, 5307, 5910 | admin, c#, cmd, process | <h1>How to run msi installer in cmd as admin using C#</h1>
<p>I have an msi installer that I need to install it silently from the C#</p>
<pre><code>Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.WorkingDirectory = @"C:\temp\";
process.StartInfo.Arguments = "msiexec /quiet /i... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,299 | cmd | # How to run msi installer in cmd as admin using C#
I have an msi installer that I need to install it silently from the C#
```
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.WorkingDirectory = @"C:\temp\";
process.StartInfo.Arguments = "msiexec /quiet /i Setup.msi ADDLOCAL=... | as V2Solutions - MS Team mentioned , the solution is to change the following
```
process.StartInfo.FileName = "msiexe.exe"
```
and the code will be
```
Process process = new Process();
process.StartInfo.FileName = "msiexec";
process.StartInfo.WorkingDirectory = @"C:\temp\";
process.StartInfo.Arguments = " /quiet /i ... |
21760612 | Create an Admin User with FosUserBundle | 15 | 2014-02-13 16:59:29 | <p>I try to create an Admin User with FOsUserBundle from command windows with the following command:</p>
<pre><code>php app/console fos:user:create
</code></pre>
<p>In my project the Admin User extends other user with mandatory propriety. So, when I choose my username, mail and password, it tells me:</p>
<pre><code>... | 24,098 | 2,980,075 | 2021-10-10 12:22:27 | 21,764,078 | 14 | 2014-02-13 19:47:12 | 814,253 | 2014-02-23 23:04:09 | https://stackoverflow.com/q/21760612 | https://stackoverflow.com/a/21764078 | <p>Only possibile way to reach that to me is</p>
<p>1 - override the cli command of <code>FOSUserBundle</code> placed into <code>Command/CreateUserCommand.php</code> <br>
2 - override the user create method of <code>FOSUserBundle</code> placed into <code>Util/UserManipulator.php</code></p>
<pre><code>// Command/Creat... | <p>Only possibile way to reach that to me is</p> <p>1 - override the cli command of <code>FOSUserBundle</code> placed into <code>Command/CreateUserCommand.php</code> <br> 2 - override the user create method of <code>FOSUserBundle</code> placed into <code>Util/UserManipulator.php</code></p> <pre><code>// Command/Creat... | 2631, 5307, 57799, 75908 | admin, cmd, fosuserbundle, symfony | <h1>Create an Admin User with FosUserBundle</h1>
<p>I try to create an Admin User with FOsUserBundle from command windows with the following command:</p>
<pre><code>php app/console fos:user:create
</code></pre>
<p>In my project the Admin User extends other user with mandatory propriety. So, when I choose my username,... | q.PostTypeId = 1; a.PostTypeId = 2; EXISTS tag '%cmd%' OR '%batch%'; a.Body contains code block; q.Score > 5; a.Score > 10 | 13,300 | cmd | # Create an Admin User with FosUserBundle
I try to create an Admin User with FOsUserBundle from command windows with the following command:
```
php app/console fos:user:create
```
In my project the Admin User extends other user with mandatory propriety. So, when I choose my username, mail and password, it tells me:
... | Only possibile way to reach that to me is
1 - override the cli command of `FOSUserBundle` placed into `Command/CreateUserCommand.php`
2 - override the user create method of `FOSUserBundle` placed into `Util/UserManipulator.php`
```
// Command/CreateUserCommand.php
protected function execute(InputInterface $input, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.