Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ max_line_length = 120

[*.md]
trim_trailing_whitespace = false

[*.{cmd,bat}]
end_of_line = crlf
insert_final_newline = true
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@

# Force batch scripts to always use CRLF line endings as they in some cases might not work correctly.
# Also if a repo is accessed in Windows via a file share from Linux, the scripts will work too
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
*.cmd text eol=crlf
*.bat text eol=crlf
26 changes: 15 additions & 11 deletions scripts/cmd/_run_enceladus.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ IF "%ASYNCHRONOUS_MODE%"=="true" (
GOTO :eof

:client_run

CALL :temp_log_file TMP_PATH_NAME

:: Initializing Kerberos ticket
Expand Down Expand Up @@ -658,17 +659,20 @@ EXIT /B 0
EXIT /B 0

:temp_log_file
SET yyyy=%date:~-4%
SET MM=%date:~3,2%
SET DD=%date:~0,2%
::alternate date parsing
::SET YYYY=%date:~10,4%
::SET MM=%date:~4,2%
::SET DD=%date:~7,2%
SET HH=%time:~0,2%
IF %HH% lss 10 (SET HH=0%time:~1,1%)
SET MI=%time:~3,2%
SET SS=%time:~6,2%
::Date&Time parsing
FOR /F "skip=1 tokens=1-6" %%A IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO (
if "%%B" NEQ "" (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, naturally, I would have looked for cmd alternative for shell myCommand | head -n2 | tail -n1, but this seems to be simply available only in powershell 🙄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit, I found this on the Internet, not my invention at all.

SET /A FDATE=%%F*10000+%%D*100+%%A
:: prefixing 1000000 to ensure the hours is two digit (starting with 0 before 10)
SET /A FTIME=1000000+%%B*10000+%%C*100+%%E
Comment on lines +665 to +667
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very interesting approach, but why not. I would have naturally attempted to created a number-padding method, but this works well, too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it the easiest. Batch scripts are designed to manipulate strings, as I see it 😉

)
)
SET YYYY=%FDATE:~0,4%
SET MM=%FDATE:~4,2%
SET DD=%FDATE:~6,2%
SET HH=%FTIME:~1,2%
SET MI=%FTIME:~3,2%
SET SS=%FTIME:~5,2%
SET DATETIME=%YYYY%_%MM%_%DD%-%HH%_%MI%_%SS%
CALL :last_part NAME,.,%CLASS%
:loop_gtlf
Expand Down