gomasch Development Notes

Montag, März 06, 2006

code colorizer

just a link: http://www.carlosag.net/Tools/CodeColorizer/

Martin 13:05 | 0 comments |

Mittwoch, März 01, 2006

batch files: search and replace strings in a variable

Task: Create timestamped filename in a batch file.

Problem: %DATE% is ok (1.03.2005 on my pc) but %TIME% returns a string with colons (17:37:59,49) which are not allowed in file names.

Solution: Put e.g. %DATE%-%TIME% into a variable and replace its colons (:) with a hyphen (-) with Batchfiles SET - Variable Editing.

SET FileName=SomethingFrom%DATE%-%TIME%.txt

SET FileName=%FileName::=_%

A quick fix for simple problem. I just didn't know until now that search and replace in strings was possible in batch files. Did old DOS already support this?

Martin 17:54 | 0 comments |