Search found 4564 matches
- 07 Feb 2025 10:32
- Forum: DOS Batch Forum
- Topic: Issue with Directory Extraction & Spaces
- Replies: 5
- Views: 6296
Re: Issue with Directory Extraction & Spaces
Think the original intention was the following, given the argument is a path: set "tmpVar=%%~png" Hmm. I'd rather expect the intention was %%~pn x g :lol: (Only guessing though.) Why? Because even a folder name containing one or more dots is perfectly valid. Without the x, both the last dot and the...
- 06 Feb 2025 12:07
- Forum: DOS Batch Forum
- Topic: Issue with Directory Extraction & Spaces
- Replies: 5
- Views: 6296
Re: Issue with Directory Extraction & Spaces
The expanded string using the "~p" modifier will always contain a leading backslash. (Why do you think this is depending on the path containing spaces?) "C:" is a drive "C:\" is the root folder of drive C: "\" is the root folder relative to the current drive "\wherever" is a path relative to the cur...
- 26 Jan 2025 17:40
- Forum: DOS Batch Forum
- Topic: How to pass a variable in batch/javascript hybrid
- Replies: 6
- Views: 7644
Re: How to pass a variable in batch/javascript hybrid
Hi Sponge Belly I can't actually answer some of your qestions. Why all the tokens and delims, and why the asterisk between %%a and %%b? That's copy/paste from Izya's code. It extracts certain substrings and the asterisk is added to the output for a reason that I can't tell. Lastly, what is the reaso...
- 23 Jan 2025 17:00
- Forum: DOS Batch Forum
- Topic: How to pass a variable in batch/javascript hybrid
- Replies: 6
- Views: 7644
Re: How to pass a variable in batch/javascript hybrid
This requires quite some trickery where you should execute the the JScript in a WSF job that respects the "encoding" attribute. However, this is still not good enough to make it work for the underlying pipe in a FOR /F loop. So, you need a UTF-16 encoded temporary file... proof of concept <?xml : : ...
- 23 Jan 2025 11:10
- Forum: DOS Batch Forum
- Topic: Running a program in batch
- Replies: 1
- Views: 4867
Re: Running a program in batch
The reason why you didn't find anything useful in the web is that Batch is not capable to interact with a window. You can't send keyboard or mouse input to a window without the aid of other languages or third party software. There are scripting langues that are more suitable, and there are languages...
- 23 Jan 2025 10:59
- Forum: DOS Batch Forum
- Topic: How to pass a variable in batch/javascript hybrid
- Replies: 6
- Views: 7644
Re: How to pass a variable in batch/javascript hybrid
Escaping all the characters that have a special meaning in batch can be an annoying task. Furthermore it's a well known issue that the scripting engines of VBScript and JScript remove all quotes from the arguments you pass to a script and there's nothing that you could do to prevent this. So, don't ...
- 06 Oct 2024 05:05
- Forum: DOS Batch Forum
- Topic: why does help for copy mention /B so much in parameters?
- Replies: 1
- Views: 19756
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: 30341
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: 33088
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: 57876
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: 179317
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: 179317
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: 179317
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: 41842
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: 19957
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