snipt

Ctrl+h for KB shortcuts

Batchfile

Run all files in current folder bat file

1
2
3
:: Run all files in current folder
:: No spaces in files' names! (Except this bat file name - so it won't start files forever in recursion)
for /r %%i in (*) do start %%i
https://snipt.net/embed/8ab47e79080e32d0f41c876afdd02bc8/
https://snipt.net/raw/8ab47e79080e32d0f41c876afdd02bc8/
8ab47e79080e32d0f41c876afdd02bc8
bat
Batchfile
3
2016-09-24T19:10:38
True
False
False
Feb 12, 2013 at 01:25 PM
/api/public/snipt/53825/
run-all-files-in-current-folder-bat-file
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c">:: Run all files in current folder</span> </span><span id="L-2"><a name="L-2"></a><span class="c">:: No spaces in files&#39; names! (Except this bat file name - so it won&#39;t start files forever in recursion)</span> </span><span id="L-3"><a name="L-3"></a><span class="k">for</span> <span class="n">/r</span> <span class="nv">%%i</span> in (*) <span class="k">do</span> start <span class="nv">%%i</span> </span></pre></div> </td></tr></table>
batch, file

Text only

Playlist

dir /s /O:N /B *.flac > playlist.m3u
https://snipt.net/embed/5e52fbf5fd0cb1e32bfa9d40d4a2f855/
https://snipt.net/raw/5e52fbf5fd0cb1e32bfa9d40d4a2f855/
5e52fbf5fd0cb1e32bfa9d40d4a2f855
text
Text only
1
2016-09-22T03:56:06
True
False
False
/api/public/snipt/42266/
-316
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>dir /s /O:N /B *.flac &gt; playlist.m3u </span></pre></div> </td></tr></table>
batch

Batchfile

Sleep in batch

:Pause the program until -w (miliseconds) passes
PING 1.1.1.1 -n 1 -w 60000 >NUL
https://snipt.net/embed/41a53943d52a27684212fc8fd18616ec/
https://snipt.net/raw/41a53943d52a27684212fc8fd18616ec/
41a53943d52a27684212fc8fd18616ec
bat
Batchfile
2
2016-09-21T14:22:41
True
False
False
/api/public/snipt/35473/
sleep-in-batch
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nl">:Pause</span> the program until -w (miliseconds) passes </span><span id="L-2"><a name="L-2"></a>PING <span class="m">1</span>.<span class="m">1</span>.<span class="m">1</span>.<span class="m">1</span> -n <span class="m">1</span> -w <span class="m">60000</span> <span class="p">&gt;</span><span class="n">NUL</span> </span></pre></div> </td></tr></table>
batch, sleep, windows

Batchfile

Sync time with DC

1
2
3
4
REM The following script will check and resync the time with the main domain controller
@echo off
net time
net time /set /yes
https://snipt.net/embed/a47be8b2f7fb363615615ed277f95ca2/
https://snipt.net/raw/a47be8b2f7fb363615615ed277f95ca2/
a47be8b2f7fb363615615ed277f95ca2
bat
Batchfile
4
2016-09-22T20:10:01
True
False
False
Aug 02, 2012 at 09:57 AM
/api/public/snipt/34638/
sync-time-with-dc
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c">REM The following script will check and resync the time with the main domain controller</span> </span><span id="L-2"><a name="L-2"></a><span class="p">@</span><span class="k">echo</span> <span class="k">off</span> </span><span id="L-3"><a name="L-3"></a>net time </span><span id="L-4"><a name="L-4"></a>net time <span class="n">/set</span> <span class="n">/yes</span> </span></pre></div> </td></tr></table>
batch

Batchfile

show programs using ports

netstat -a -n -b -p tcp
https://snipt.net/embed/41a3f145882f9f46db686a1a11032327/
https://snipt.net/raw/41a3f145882f9f46db686a1a11032327/
41a3f145882f9f46db686a1a11032327
bat
Batchfile
1
2016-09-22T10:04:14
True
False
False
/api/public/snipt/32930/
show-programs-using-ports
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>netstat -a -n -b -p tcp </span></pre></div> </td></tr></table>
batch, server, windows

Batchfile

create file with date and time on name

1
2
3
4
5
6
@echo off

set hora=%time:~0,2%%time:~3,2%%time:~6,2%
set data=%date:~0,2%%date:~3,2%%date:~6,4%

php --version > version_%data%_%hora%.txt
https://snipt.net/embed/8cea93cb6a41d5ab9ebdeaac9b9a4d67/
https://snipt.net/raw/8cea93cb6a41d5ab9ebdeaac9b9a4d67/
8cea93cb6a41d5ab9ebdeaac9b9a4d67
bat
Batchfile
6
2016-09-21T14:15:09
True
False
False
/api/public/snipt/32174/
create-file-with-date-and-time-on-name
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="p">@</span><span class="k">echo</span> <span class="k">off</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="k">set</span> <span class="nv">hora</span><span class="o">=</span><span class="nv">%time:~0</span><span class="p">,</span><span class="m">2</span><span class="nv">%%time:~3</span><span class="p">,</span><span class="m">2</span><span class="nv">%%time:~6</span><span class="p">,</span><span class="m">2</span>% </span><span id="L-4"><a name="L-4"></a><span class="k">set</span> <span class="nv">data</span><span class="o">=</span><span class="nv">%date:~0</span><span class="p">,</span><span class="m">2</span><span class="nv">%%date:~3</span><span class="p">,</span><span class="m">2</span><span class="nv">%%date:~6</span><span class="p">,</span><span class="m">4</span>% </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>php --version <span class="p">&gt;</span> <span class="n">version_</span><span class="nv">%data%</span>_<span class="nv">%hora%</span>.txt </span></pre></div> </td></tr></table>
batch, cmd, windows
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.