Search found 4528 matches
- 06 Oct 2024 05:05
- Forum: DOS Batch Forum
- Topic: why does help for copy mention /B so much in parameters?
- Replies: 1
- Views: 10343
Re: why does help for copy mention /B so much in parameters?
Options at the beginning apply to all sources and the destination. However, you can also define it for every source separately as well as for the destination. In this case you better really define /a or /b for every file as such options are seemingly taken over for the rest of the command if you lea...
- 30 Sep 2024 09:40
- Forum: DOS Batch Forum
- Topic: getting a filesize doesnt work without * in it, wish to know why
- Replies: 3
- Views: 19641
Re: getting a filesize doesnt work without * in it, wish to know why
The first question that I have is WHY do you need FOR /R. Do you really need to search the file recursively in subdirectories? I'm asking because ... ECHO The file size of %DSPEC%\%FNAME% is %FSIZE% bytes ... indicates you already know that the full name of the file is %DSPEC%\%FNAME%. If so, FOR /R...
- 29 Sep 2024 03:49
- Forum: DOS Batch Forum
- Topic: Open multiple CMD windows running pings, tracert etc and position them on screen
- Replies: 2
- Views: 20451
Re: Open multiple CMD windows running pings, tracert etc and position them on screen
There is no way to do that in Batch only. I remember a few snippets I wrote for this purpose where Batch calls PowerShell which contains C# code that wraps the Win32 API ... Sounds like a mess and is a mess. https://www.dostips.com/forum/viewtopic.php?f=3&t=8822 https://www.dostips.com/forum/viewtop...
- 07 Sep 2024 04:08
- Forum: DOS Batch Forum
- Topic: Observations about the tilde-dollar syntax %~$variable:I
- Replies: 3
- Views: 45834
Re: Observations about the tilde-dollar syntax %~$variable:I
Great investigation as always, jeb!
However, you probably don't believe my first reaction when I saw the topic
Like: "Wait a second ... What the ...? I could have also used anything else but PATH in all the years that I write batch code? D'oh "
However, you probably don't believe my first reaction when I saw the topic
Like: "Wait a second ... What the ...? I could have also used anything else but PATH in all the years that I write batch code? D'oh "
- 06 Sep 2024 10:31
- Forum: DOS Batch Forum
- Topic: printf.exe: Arithmetic and Programming
- Replies: 31
- Views: 130364
Re: printf.exe: Arithmetic and Programming
That's great. I suppose that the ESC#3 and ESC#4 change font sequences works only in Windows 11 (I have Windows 10). Unfortunately that seems to be the case. This is how it looks like in a Win 11 console. double_height_width.png The way I write assembler code is simpler and more direct, similar to C...
- 03 Sep 2024 10:04
- Forum: DOS Batch Forum
- Topic: printf.exe: Arithmetic and Programming
- Replies: 31
- Views: 130364
Re: printf.exe: Arithmetic and Programming
@Saso I thought it was about printf as you asked in this thread. However, no problem. Just create an escape character and assign it to a variable as you already know: for /f %%i in ('echo prompt $E^|cmd') do set "ESC=%%i" echo %ESC%#3 Some text - displayed with double height and double width. echo %...
- 02 Sep 2024 12:49
- Forum: DOS Batch Forum
- Topic: printf.exe: Arithmetic and Programming
- Replies: 31
- Views: 130364
Re: printf.exe: Arithmetic and Programming
Works for me, Saso. printf "%c#3Double Height (implies Double Width)\n%c#4Double Height (implies Double Width)\n" 27 27 Tested in the prompt of Windows Terminal. In a batch script you have to double the percent signs as always. And I think to make it also work in a console window, Antonio would have...
- 27 Aug 2024 11:50
- Forum: DOS Batch Forum
- Topic: Docs: GOTO Bug Clarification
- Replies: 4
- Views: 29537
Re: Docs: GOTO Bug Clarification
Yeah, to be clear - SS64 is a pretty good reference. The official MS docs don't tell you about such effects of GOTO. However, I still think that "bug" is the wrong wording here. Just an example of how I understand it: @echo off goto label&echo FOO :label echo BAR pause FOO is never printed as the GO...
- 27 Aug 2024 09:29
- Forum: DOS Batch Forum
- Topic: Execute filename as a comand
- Replies: 1
- Views: 11320
Re: Execute filename as a comand
Fortunately you have to use %~n0 in your example. Similarly, it's already been the source for headaches of a lot of people whenever they named the script file the same as any command used in the code
Steffen
Steffen
- 27 Aug 2024 09:16
- Forum: DOS Batch Forum
- Topic: Docs: GOTO Bug Clarification
- Replies: 4
- Views: 29537
Re: Docs: GOTO Bug Clarification
SS64 is for sure not the official docs. So you may ask the author of the site to disambiguate their statement.
IMO it refers to & and && following a GOTO command. However, I would consider this to be expected behavior rather than a bug.
Steffen
IMO it refers to & and && following a GOTO command. However, I would consider this to be expected behavior rather than a bug.
Steffen
- 24 Aug 2024 05:41
- Forum: DOS Batch Forum
- Topic: Batch file question
- Replies: 2
- Views: 30416
Re: Batch file question
I'm not entirely sure what your expectation is.
In your second example the folder E:\Dir is backed up into the root of G: as you specified. /MIR implies /PURGE which deletes all directories that are not in the source. So what do you think should have happened instead?
Steffen
In your second example the folder E:\Dir is backed up into the root of G: as you specified. /MIR implies /PURGE which deletes all directories that are not in the source. So what do you think should have happened instead?
Steffen
- 10 Aug 2024 08:46
- Forum: DOS Batch Forum
- Topic: "TermStrWidth" utility – measure the number of cells a string occupies in the CLI.
- Replies: 2
- Views: 19230
Re: "TermStrWidth" utility – measure the number of cells a string occupies in the CLI.
Thanks Saso! As this is about predicting the appearance of strings I should have provided some examples and screenshots. So in the attached zip is a little code where the pictures below are based on. Tested on Win 11. The font is Cascadia Code. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
- 10 Aug 2024 04:30
- Forum: DOS Batch Forum
- Topic: string manipulation, display a whole line or cut and display the part
- Replies: 3
- Views: 20758
Re: string manipulation, display a whole line or cut and display the part
is there a way to make 69 as a variable manipulation without introducing a new variable? No. FWIW in your initial post you wrote "if the line is less than 70". Was that meant to be "<= 70" rather than "< 70"? %DS2%-1 didnt work inside !!, just for my learning purpose Because SET /A is for calculati...
- 09 Aug 2024 09:26
- Forum: DOS Batch Forum
- Topic: string manipulation, display a whole line or cut and display the part
- Replies: 3
- Views: 20758
Re: string manipulation, display a whole line or cut and display the part
Not tested:
Note that you have to update your DS2 value to 45 as it defines the number of characters after DS1.
Steffen
Code: Select all
if "!VV:~0,69!"=="!VV!" (
echo !DD! !VV!
) else (
echo !DD! !VV:~%DS%,%DS2%!
)
Steffen
- 06 Aug 2024 16:09
- Forum: DOS Batch Forum
- Topic: "TermStrWidth" utility – measure the number of cells a string occupies in the CLI.
- Replies: 2
- Views: 19230
"TermStrWidth" utility – measure the number of cells a string occupies in the CLI.
What? This little tool measures the display width of strings in the Windows Terminal / Console. It is basically a copy of the recently revised code for this purpose in Microsoft's open source repository. All credits go to their Terminal team. I used this code in order to actually get the same result...