Search found 9 matches

by PiotrMP006
28 Sep 2020 03:05
Forum: DOS Batch Forum
Topic: How to remove Quotes from a variable with "ampersand" (&) ?
Replies: 1
Views: 50

How to remove Quotes from a variable with "ampersand" (&) ?

How to remove Quotes from a variable with "ampersand" (&) ?

ex

setlocal disabledelayedexpansion

set dir="D:\Test ! & Test\"

set dir=%dir:"=%

after

echo %dir%

D:\Test ! Test\

Sign & is missing !!!!

Please help
by PiotrMP006
16 Aug 2020 09:19
Forum: DOS Batch Forum
Topic: How do I get an extension if the filename has two dots?
Replies: 1
Views: 411

How do I get an extension if the filename has two dots?

How do I get an extension if the filename has two dots?

ex.

Test.aaa.txt

%~r1 -> aaa.txt

Please help me
by PiotrMP006
23 Dec 2019 06:34
Forum: DOS Batch Forum
Topic: For /f loop findstr problem The batch script finds nothing !!!
Replies: 2
Views: 1389

For /f loop findstr problem The batch script finds nothing !!!

"C:\Program Files\7-Zip\7z.exe" h -scrcsha256 "Test.7z" output: SHA256 Size Name ---------------------------------------------------------------- ------------- ------------ 1D29A48C53E20F5E854FA67A81FFAD7366DF42E507D319CC41FF21E7DE4A4DBC 106 Test.7z --------------------------------------------------...
by PiotrMP006
23 Dec 2019 01:38
Forum: DOS Batch Forum
Topic: How do I find an error in the for loop if there is no directory found?
Replies: 1
Views: 1211

How do I find an error in the for loop if there is no directory found?

How do I find an error in the for loop if there is no directory found?

ex.

Code: Select all

for /f "tokens=*" %%a in ('dir "%cd%" /a:d /b 2^> nul') do (
echo %%a
)
%errorlevel% always is 0

Please help me
by PiotrMP006
09 Dec 2019 06:12
Forum: DOS Batch Forum
Topic: If Else bracket error Help
Replies: 2
Views: 1358

If Else bracket error Help

Why this code does not work?

Code: Select all

if exist "D:\Test1" if exist "D:\Test2" (
echo OK
) else (
echo Error
)
pause
This code works but I don't know why this extra brace?

Code: Select all

if exist "D:\Test1" if exist "D:\Test2" (
echo OK
)
) else (
echo Error
)
pause
Please Help
by PiotrMP006
02 Apr 2019 02:13
Forum: DOS Batch Forum
Topic: How to check console window width columns in bath script?
Replies: 1
Views: 1069

How to check console window width columns in bath script?

Hi

How to check console window width columns in bath script?
by PiotrMP006
19 Jun 2018 06:30
Forum: DOS Batch Forum
Topic: What's wrong" For loop and pipe | "" problem
Replies: 3
Views: 1576

What's wrong" For loop and pipe | "" problem

Code: Select all

for /f %%a in ('gpg --list-keys --with-colons ^| findstr "Peter Pan"') do set test=%%a
With findstr "Peter Pan" don't work

With findstr Peter work

Why don't work with ""

Help
by PiotrMP006
04 Oct 2017 02:18
Forum: DOS Batch Forum
Topic: How to correctly remove all files from a directory in Windows7?
Replies: 1
Views: 852

How to correctly remove all files from a directory in Windows7?

How to correctly remove all files from a directory in Windows7?

Without *

Code: Select all

del C:\Test

With *

Code: Select all

del C:\Test\*
by PiotrMP006
08 Sep 2017 06:13
Forum: DOS Batch Forum
Topic: How to sort numeric variables ascending in DOS Batch?
Replies: 2
Views: 1740

How to sort numeric variables ascending in DOS Batch?

How to sort numeric variables ascending in DOS Batch?

ex.

set number1=4
set number2=1
set number3=5
set number4=2
set number5=3

How to create a variable with sorted numbers

Result 1 2 3 4 5