views:

23

answers:

1

How do I accomplish this:

for /f "tokens=1-4 delims=: " %%a in ('%time%') do set XTime=%%a.%%b.%%c.%%d

I'm trying to get the contents of %time% e.g., 16:25:15.65 into 16.25.15.65.

Running the command above gives me:

The filename, directory name, or volume label syntax is incorrect.

(If it matters I'm on Windows XP)

A: 

Figured it out, turns out I just needed double quotes:

for /f "tokens=1-4 delims=: " %%a in ("%time%") do set XTime=%%a.%%b.%%c.%%d
Greg
Single quotes would tell `for` to interpret it as a command to execute. Since something like `23:36:25,24` can't be executed ...
Joey