2012-04-02 5 views
2

가 나는 PowerShell 명령 실행을, 명령은 나는 또한powershell 및 배치 파일 조합? 나는 박쥐 파일을 실행할 때

powershell.exe " [long]((date). touniversaltime() -[datetime]'1970-01-01 ') . totalmilliseconds " 

이 화면에 올바른 데이터를 반환를 사용했다

@powershell -command " [long]((date) . touniversaltime() - [datetime]' 1970-01-01 '). totalmilliseconds" 

하지만 내 질문은 어떻게 이 값을 저장하고 파일 이름에 첨부하는 데 사용합니까? 당신에게 감사 해

왠지 내 이전 응답의 코드를 기억

답변

3
for /f %%x in ('powershell "[long]((date).touniversaltime()-[datetime]'1970-01-01').totalmilliseconds"') do set ms=%%x 
rem do whatever you want with %ms% 

. 이전의 조언은 여전히 ​​충고합니다. 유지 관리가 두 배나되는 이상한 하이브리드를 만드는 대신 스크립트를 PowerShell에 작성하십시오.

+0

도움 주셔서 감사합니다. – AlanF

관련 문제