Search found 1979 matches

by penpen
25 May 2024 14:15
Forum: DOS Batch Forum
Topic: (nearly) ieee 754 floating point single precisition
Replies: 46
Views: 31218

Re: (nearly) ieee 754 floating point single precisition

When i divide high by 2 (realized by high>>=1), then there is an underflow in case high contains an odd number. I don't want to lose that underflowed portion, so i force it to be the leading character of low (low=!c!!low!). But if the leading character of low is 0, then the set/a-command treats low ...
by penpen
24 May 2024 14:20
Forum: DOS Batch Forum
Topic: (nearly) ieee 754 floating point single precisition
Replies: 46
Views: 31218

Re: (nearly) ieee 754 floating point single precisition

Then this part how to do it? "normalize that value such That 1 <= decimal number (d) <2" Example ..... After (finally) looking at the code, I would say (in case i didn't msiread my code), that i used a strlength algorithm on d, to shift the first non 0 digit at the first place of after the decimal ...
by penpen
23 May 2024 17:13
Forum: DOS Batch Forum
Topic: (nearly) ieee 754 floating point single precisition
Replies: 46
Views: 31218

Re: (nearly) ieee 754 floating point single precisition

Yes, you got it right so far. If i remember right, then the basic idea is to start with a number string in scientific notation, transform that into a decimal floating point representation with exponent to base ten (sign, decimal number, exponent to base 10), transform that into a decimal floating po...
by penpen
17 May 2024 16:17
Forum: DOS Batch Forum
Topic: dir ????????.txt does not show only files with length of 8 characters
Replies: 7
Views: 322

Re: dir ????????.txt does not show only files with length of 8 characters

I would guess that you might find the short names of some files (in case that feature is activated on your system).
You might test that by forcing the dir command to also display short filenames:

Code: Select all

dir /x "????????.txt"

penpen
by penpen
17 May 2024 16:13
Forum: DOS Batch Forum
Topic: Difficulty running powershell in a for loop due to unquoting and closing of parenthesis
Replies: 3
Views: 328

Re: Difficulty running powershell in a for loop due to unquoting and closing of parenthesis

You have to escape the characters, that are not encapsulated within double quotes, which in the example should be everything colored red: powershell -command " Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorID | ForEach-Object { $_.PSObject.Properties | ForEach-Object { if ($_.Name -ne 'Ci...
by penpen
17 May 2024 15:53
Forum: DOS Batch Forum
Topic: What is this batch file doing (to make color text)?
Replies: 3
Views: 203

Re: What is this batch file doing (to make color text)?

The for/f loop uses the prompt command to store the Backspace character into the envronment variable DEL. The set/p command stores the backspace character into a file with the name defined by the second parameter of the :colorText function. The findstr command searches for any non empty line in that...
by penpen
14 May 2024 05:36
Forum: DOS Batch Forum
Topic: pushd popd depend on batch filenames with which they run... why?
Replies: 13
Views: 1035

Re: pushd popd depend on batch filenames with which they run... why?

To be clear: There is no bug, only wrong expectations.
by penpen
10 May 2024 10:14
Forum: DOS Batch Forum
Topic: pushd popd depend on batch filenames with which they run... why?
Replies: 13
Views: 1035

Re: pushd popd depend on batch filenames with which they run... why?

You got sth wrong with "%~0\..", so let's consider starting the batch file "crysis2.bat" from the current directory "c:\ABC\Bin32". Here the string "%~0\.." is expanded to "crysis2.bat\..". The string neither starts with a "\\", nor with a vomue designator (like for example "X:"). Therefore it is a ...
by penpen
04 May 2024 15:35
Forum: DOS Batch Forum
Topic: pushd popd depend on batch filenames with which they run... why?
Replies: 13
Views: 1035

Re: pushd popd depend on batch filenames with which they run... why?

The reason why 'pushd "%~0\.."' works is pretty simple: Your batch file was successfully started from an initial location with the content of %0, so it must contain a path from the initial location to the batch file location. The 'pushd' command expects a path to a directory and doesn't expect any n...
by penpen
01 May 2024 18:47
Forum: DOS Batch Forum
Topic: pushd popd depend on batch filenames with which they run... why?
Replies: 13
Views: 1035

Re: pushd popd depend on batch filenames with which they run... why?

What exactly are you looking for, when you write "i will find a detour to find a parent dir name"? Are you looking for the parent name of the current directory, or the name of your currently running batch file's directory, or sth else? I suspect you might look for sth like the following: @echo off s...
by penpen
01 May 2024 08:29
Forum: DOS Batch Forum
Topic: pushd popd depend on batch filenames with which they run... why?
Replies: 13
Views: 1035

Re: pushd popd depend on batch filenames with which they run... why?

Though the output indeed depends on the filename used when calling the batch, the examples you have used shouldn't produce different results if being called in the same way. If you call the file with a filename only (encapsulated in doublequotes), then you should get this output: D:\Crysis 2\bin32\ ...
by penpen
01 May 2024 08:00
Forum: DOS Batch Forum
Topic: pipe binary mode
Replies: 1
Views: 538

Re: pipe binary mode

Without any sample data, we can only guess. The pipe exclusively works in binary mode and till now, i never saw it fail. Any encoding is done either by the command line interpreter, or by the programs on each end of the pipe. In my experience the most common error is that the program on the sink sid...
by penpen
24 Mar 2024 02:46
Forum: DOS Batch Forum
Topic: Cmdwiz - 54 operation cmd helper tool (now with Unicode)
Replies: 58
Views: 119604

Re: Cmdwiz - 54 operation cmd helper tool (now with Unicode)

Usually when opening a console the cmd line is 'C:\Windows\System32\cmd.exe', while when double clicking a bat the cmd line is 'C:\WINDOWS\system32\cmd.exe /c "<path to batch fie>" ', which might result in different defaults beeing loaded. You might check the default values by: - creating a link to ...
by penpen
21 Mar 2024 19:17
Forum: DOS Batch Forum
Topic: How to delete lines of file without changind date?
Replies: 1
Views: 1041

Re: How to delete lines of file without changind date?

You might use powershell within cmd.exe to change the last modified date of a file, so this might help you: @echo off setlocal enableExtensions disableDelayedExpansion set "sourceFile=%~f0" set "targetFile=stest.txt" powershell.exe -Command "$(Get-Item '%targetFile%').LastWriteTime=$(Get-Item '%sour...