-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjoin_book.bat
More file actions
38 lines (29 loc) · 834 Bytes
/
join_book.bat
File metadata and controls
38 lines (29 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<# batch file posh loader
@cls
@echo off
powershell.exe -command "start powershell -ArgumentList ""-command """"""iex ([System.IO.File]::ReadAllText('%0'))"""""""""""
#powershell.exe -command "start powershell -ArgumentList ""-command """"""iex ([System.IO.File]::ReadAllText('%0'))"""""""""" -Verb RunAs"
#powershell.exe -command " iex ([System.IO.File]::ReadAllText('%0')) "
goto :EOF
#>
$index = 0
$file = './parts/0.md'
$text = @{}
echo '>>>>> Step 1/2. Splitting...'
get-content "./hpmor_ru.md" |
foreach {
if($_.StartsWith('#')) {
$index += 1
$file = './parts/' + $index + ' - ' + $_.Trim('#', ' ') + '.md'
$file = $file.Replace(':', ' - ')
$_
}
$text[$file] = $text[$file] + $_ + "`r`n"
}
echo '`r`n>>>>> Step 2/2. Writing...'
$text.GetEnumerator() |
foreach {
$_.Key
$text[$_.Key] >> $_.Key
}
read-host