Search found 29 matches

by PiotrMP006
10 Jan 2024 02:07
Forum: DOS Batch Forum
Topic: How to replace the script name %~n0 with a string of "-" characters of length %~n0?
Replies: 1
Views: 2249

How to replace the script name %~n0 with a string of "-" characters of length %~n0?

Hi

How to replace the script name %~n0 with a string of "-" characters of length %~n0?

Code: Select all

ex. %~n0 = Test.bat

How do I change "Test.bat" to the string "---------" ?

Test.bat
--------
by PiotrMP006
21 Dec 2023 03:30
Forum: DOS Batch Forum
Topic: Why for loop wmic get processid return an extra invalid value?
Replies: 3
Views: 2957

Why for loop wmic get processid return an extra invalid value?

Hi Why for loop wmic get processid return an extra invalid value? for /f "usebackq skip=1 delims=" %%a in (`wmic process where "name='cmd.exe' and commandline like '%%%~n0%%'" get processid 2^>nul`) do echo %%a The first returned value %%a is the real processid The second returned value %%a is a non...
by PiotrMP006
18 Dec 2023 00:23
Forum: DOS Batch Forum
Topic: How can a batch lower the priority ONLY of the cmd that runs it?
Replies: 1
Views: 2526

How can a batch lower the priority ONLY of the cmd that runs it?

Hi

How can a batch lower the priority ONLY of the cmd that runs it?

Why isn't this code working?

Code: Select all

wmic process where "name='cmd.exe' and commandline like '%%scriptname%%'" call setpriority "high"
Please help
by PiotrMP006
15 Dec 2023 08:55
Forum: DOS Batch Forum
Topic: How to make an underscore variable "-----" with the length of the argument variable?
Replies: 5
Views: 6055

How to make an underscore variable "-----" with the length of the argument variable?

How to make an underscore variable "-----" with the length of the argument variable?

ex.

Code: Select all

Script Name
-----------
Please help
by PiotrMP006
26 Jul 2023 07:17
Forum: DOS Batch Forum
Topic: How to detect in 7-Zip fatal error #2 "Wrong password" in windows batch?
Replies: 2
Views: 1517

How to detect in 7-Zip fatal error #2 "Wrong password" in windows batch?

Hi

How to detect in 7-Zip fatal error #2 "Wrong password" in windows batch?

Code: Select all

ERROR: a.7z : Cannot open encrypted archive. Wrong password?
by PiotrMP006
23 Jul 2023 07:54
Forum: DOS Batch Forum
Topic: Does "endlocal" close all instances of "setlocal"?
Replies: 2
Views: 1764

Does "endlocal" close all instances of "setlocal"?

Does "endlocal" close all instances of "setlocal"?

ex

Code: Select all

setlocal enabledelayedexpansion enableextensions
set name1=1

setlocal disabledelayedexpansion enableextensions
set name2=2

setlocal enabledelayedexpansion enableextensions
set name3=3

endlocal
by PiotrMP006
13 Jun 2023 08:50
Forum: DOS Batch Forum
Topic: How to convert argument list to skip first argument?
Replies: 5
Views: 2118

Re: How to convert argument list to skip first argument?

I need a solution with a FOR loop without SHIFT
by PiotrMP006
13 Jun 2023 08:23
Forum: DOS Batch Forum
Topic: How to convert argument list to skip first argument?
Replies: 5
Views: 2118

How to convert argument list to skip first argument?

How to convert argument list to skip first argument?

%* = "C:\7-Zip Test\" "File&Test 1.txt" "File&Test 2.txt" "File&Test 3.txt"

After conversion, this should be the argument list

%filelist% = "File&Test 1.txt" "File&Test 2.txt" "File&Test 3.txt"


Please help
by PiotrMP006
19 Aug 2022 01:44
Forum: DOS Batch Forum
Topic: How do I check the length of a filename in batch script?
Replies: 1
Views: 1979

How do I check the length of a filename in batch script?

Hi

How do I check the length of a filename in batch script?
by PiotrMP006
04 Aug 2022 03:59
Forum: DOS Batch Forum
Topic: How to replace all characters in a variable with another character?
Replies: 4
Views: 3298

Re: How to replace all characters in a variable with another character?

No

I want to replace all characters in a variable with another character.

ex

abcde -> *****
abcde -> -----
abcde -> #####


Please help me
by PiotrMP006
03 Aug 2022 06:38
Forum: DOS Batch Forum
Topic: How to replace all characters in a variable with another character?
Replies: 4
Views: 3298

How to replace all characters in a variable with another character?

Hi

How to replace all characters in a variable with another character?

ex
abcd -> ****
by PiotrMP006
17 Jul 2022 06:24
Forum: DOS Batch Forum
Topic: "call exit" - Exit batch file from call subroutine
Replies: 3
Views: 2576

Re: "call exit" - Exit batch file from call subroutine

Why is the "call exit" command bad?
by PiotrMP006
17 Jul 2022 04:56
Forum: DOS Batch Forum
Topic: "call exit" - Exit batch file from call subroutine
Replies: 3
Views: 2576

"call exit" - Exit batch file from call subroutine

Code: Select all

call exit
Is this the only effective way to exit batch file from call subroutine?
by PiotrMP006
24 Oct 2021 08:13
Forum: DOS Batch Forum
Topic: start "" changes the window title !!!!
Replies: 1
Views: 2385

start "" changes the window title !!!!

Hi

start "" changes the window title

ex

Code: Select all

start "" /b /low dir "D:\" /s

Image


Please help
by PiotrMP006
04 Oct 2021 07:11
Forum: DOS Batch Forum
Topic: How to read a file in UTF-8 and remove a BOM in batch script?
Replies: 2
Views: 4154

How to read a file in UTF-8 and remove a BOM in batch script?

Hi

How to read a file in UTF-8 and remove a BOM in batch script?