문제

I am using this code to create an environment variable with the current date and time:

setx timestamp "%DATE:/=-%@%TIME::=-%"

The effect of using this command is to create a string value "timestamp" in HKCU\Environment with the data value "Fri 26-04-2013@18-32-31.29".

What i want is to remove that space from "FRI" and "26-04-2013@18-32-31.29" to make it "Fri-26-04-2013@18-32-31.29".

Thanks

도움이 되었습니까?

해결책

Try this:

 set timestamp="%DATE:/=-%@%TIME::=-%"
 set timestamp=%timestamp: =-%
 setx timestamp %timestamp% /K HKEY_CURRENT_USER\ENVIRONMENT

다른 팁

set timestamp=%timestamp: =-%

should set all spaces currently in 'timestamp' to dashes

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top