mirror of
https://github.com/zhxycn/GetGenshinWishLink.git
synced 2024-11-21 21:58:02 +00:00
Create the script
This commit is contained in:
parent
eda87161e2
commit
012bf1d77d
40
GetGenshinWishLink.ps1
Normal file
40
GetGenshinWishLink.ps1
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
$logLocationCN = "%userprofile%\AppData\LocalLow\miHoYo\$([char]0x539f)$([char]0x795e)\output_log.txt";
|
||||||
|
$logLocationGlobal = "%userprofile%\AppData\LocalLow\miHoYo\Genshin Impact\output_log.txt";
|
||||||
|
|
||||||
|
$pathCN = [System.Environment]::ExpandEnvironmentVariables($logLocationCN);
|
||||||
|
$pathGlobal = [System.Environment]::ExpandEnvironmentVariables($logLocationGlobal);
|
||||||
|
$findCN = [System.IO.File]::Exists($pathCN);
|
||||||
|
$findGlobal = [System.IO.File]::Exists($pathGlobal);
|
||||||
|
|
||||||
|
if ($findCN -And $findGlobal) {
|
||||||
|
Write-Host "Find both China and Global log file. Please choose one. Press [1] for CN, [2] for Global." -ForegroundColor Yellow
|
||||||
|
$keyInput = [Console]::ReadKey($true).Key
|
||||||
|
if ($keyInput -eq "NumPad1" -or $keyInput -eq "D1") {
|
||||||
|
$path = $pathCN
|
||||||
|
} elseif ($keyInput -eq "NumPad2" -or $keyInput -eq "D2") {
|
||||||
|
$path = $pathGlobal
|
||||||
|
} else {
|
||||||
|
Write-Host "Invalid input." -ForegroundColor Red
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} elseif ($findCN) {
|
||||||
|
$path = $pathCN
|
||||||
|
} elseif ($findGlobal) {
|
||||||
|
$path = $pathGlobal
|
||||||
|
} else {
|
||||||
|
Write-Host "Cannot find the log file. Make sure to open the wish history first." -ForegroundColor Red
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
$logs = Get-Content -Path $path
|
||||||
|
$match = $logs -match "^OnGetWebViewPageFinish.*log$"
|
||||||
|
|
||||||
|
if (-Not $match) {
|
||||||
|
Write-Host "Cannot find the wish history url. Make sure to open the wish history first." -ForegroundColor Red
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
[string] $wishHistoryUrl = $match[$match.Length - 1] -replace 'OnGetWebViewPageFinish:', ''
|
||||||
|
Write-Host $wishHistoryUrl
|
||||||
|
Set-Clipboard -Value $wishHistoryUrl
|
||||||
|
Write-Host "Link copied to clipboard." -ForegroundColor Green
|
@ -1,2 +1,11 @@
|
|||||||
# GetGenshinWishLink
|
# GetGenshinWishLink
|
||||||
A script for getting Genshin Impact wish links on Windows.
|
A script for getting Genshin Impact wish links on Windows.
|
||||||
|
|
||||||
|
## How to use
|
||||||
|
Open Windows PowerShell and run any one of the following commands.
|
||||||
|
```
|
||||||
|
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/zhxycn/GetGenshinWishLink/main/GetGenshinWishLink.ps1'))
|
||||||
|
```
|
||||||
|
```
|
||||||
|
iex ((New-Object System.Net.WebClient).DownloadString('https://cdn.jsdelivr.net/gh/zhxycn/GetGenshinWishLink/GetGenshinWishLink.ps1'))
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user