Search found 1971 matches
- 10 May 2024 10:14
- Forum: DOS Batch Forum
- Topic: pushd popd depend on batch filenames with which they run... why?
- Replies: 11
- Views: 712
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 ...
- 04 May 2024 15:35
- Forum: DOS Batch Forum
- Topic: pushd popd depend on batch filenames with which they run... why?
- Replies: 11
- Views: 712
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...
- 01 May 2024 18:47
- Forum: DOS Batch Forum
- Topic: pushd popd depend on batch filenames with which they run... why?
- Replies: 11
- Views: 712
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...
- 01 May 2024 08:29
- Forum: DOS Batch Forum
- Topic: pushd popd depend on batch filenames with which they run... why?
- Replies: 11
- Views: 712
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\ ...
- 01 May 2024 08:00
- Forum: DOS Batch Forum
- Topic: pipe binary mode
- Replies: 1
- Views: 187
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...
- 24 Mar 2024 02:46
- Forum: DOS Batch Forum
- Topic: Cmdwiz - 54 operation cmd helper tool (now with Unicode)
- Replies: 58
- Views: 118112
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 ...
- 21 Mar 2024 19:17
- Forum: DOS Batch Forum
- Topic: How to delete lines of file without changind date?
- Replies: 1
- Views: 704
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...
- 21 Mar 2024 18:59
- Forum: DOS Batch Forum
- Topic: How to truncate a file without updating its timestamp?
- Replies: 2
- Views: 852
Re: How to truncate a file without updating its timestamp?
There are three different timestamps you might want to change using powershell, so this might help you: @echo off setlocal enableExtensions disableDelayedExpansion set "sourceFile=%~f0" set "targetFile=stest.txt" :: Read timestamps into environment variables. for /f "tokens=1-3" %%a in ('powershell....
- 19 May 2023 11:06
- Forum: DOS Batch Forum
- Topic: For/in/do question relating to Registry Backup (XP)
- Replies: 4
- Views: 4294
Re: For/in/do question relating to Registry Backup (XP)
How can I get this above "export" code to work, I cannot see where the error is? My WinXP (not the newest version of WinXP) doesn't support the "/y"-switch. Once removed, it seem to work fine. What would I use in terms of code to "Import" or to restore the resultant backed up registry? The opposite...
- 03 May 2023 18:30
- Forum: DOS Batch Forum
- Topic: Notepad bug
- Replies: 10
- Views: 9739
Re: Notepad bug
At least under win10 notepad by default tries to guess the encoding (using whatever algorithm). In your and jebs example, notepad indeed guesses wrong and assumes UTF16-LE. But opening both explicitely in ANSI-encoding works fine. So i won't call that behaviour a bug, at least under win10, though un...
- 03 May 2023 17:51
- Forum: DOS Batch Forum
- Topic: Just made batch functions functions Deconcatenate,GetLastElement and GetNthElement
- Replies: 2
- Views: 3999
Re: Just made batch functions functions Deconcatenate,GetLastElement and GetNthElement
Are there inputs that will make them choke that shouldn't ? I currently don't have much time, so i only done a quick test of typical poison characters "&()[]{}^=;!'+,`~". Work: set "TestVar=HKEY_CURRENT_USER/EUDC/666/myteststring" set "TestVar=HKEY_CURRENT_USER(EUDC/666/myteststring" set "TestVar=H...
- 30 Apr 2023 19:36
- Forum: DOS Batch Forum
- Topic: 256 colors in virtual terminal escape sequence
- Replies: 41
- Views: 54136
Re: 256 colors in virtual terminal escape sequence
I found an error, which was shifting the wrong value: ::buggy set /a "%4.index1=(%4.b1<<2) + (%4.g1<<1) + (%4.r1), %4.r1=(%4.r1+(%4.isDarkGray<<1))<<6, %4.g1=(%4.g1+(%4.isDarkGray<<1))<<6, %4.b1=(%4.b1+(%4.isDarkGray<<1))<<6" ::bugfixed: set /a "%4.index1=(%4.b1<<2) + (%4.g1<<1) + (%4.r1), %4.r1=((%...
- 29 Apr 2023 17:01
- Forum: DOS Batch Forum
- Topic: 256 colors in virtual terminal escape sequence
- Replies: 41
- Views: 54136
Re: 256 colors in virtual terminal escape sequence
I'm not sure which values i should see as an error, so i don't know what to search for. Maybe you could give me the pixel(s), the error(s) and what you would like to see instead (i changed the main loop, so you could mark that pixel with a red X): set /A "pixel.x=0, pixel.y=0, image.width=102" set "...
- 28 Apr 2023 15:46
- Forum: DOS Batch Forum
- Topic: Batch file deletion
- Replies: 2
- Views: 3700
Re: Batch file deletion
Ad hoc i can't see a statement or command that XP would not support, or use differently than the newer versions. The only potential risks of incompatability i see are: - The usage of the localization dependend variables "date" and "time" (so it could happen on all windows versions). - External execu...
- 28 Apr 2023 15:19
- Forum: DOS Batch Forum
- Topic: 256 colors in virtual terminal escape sequence
- Replies: 41
- Views: 54136
Re: 256 colors in virtual terminal escape sequence
But wouldn't it have been better to average the three colors i.e. (R + G + B) /3 ? The idea behind RGB is, that components agree on the color produced. It doesn't match how humans experience color, though the result is somewhat acceptable. Would "L" be the brightness/lightness? English is not my mo...