假设我之前在代码中已经建立了get-game函数 并且已经创建了C:\ Stock_Market \ $ Username.ps1并且此文件位于相同的C:\ Stock_Market文件夹中,为什么系统找不到$ Username.ps1?
如何调用$ Username.ps1中的命令在此文件中运行?
function Log-In {
Clear-Host
$Username = Read-Host "Username"
$Password = Read-Host "Password"
$filepath = "C:\Stock_Market\$Username.ps1"
If (Test-Path $filepath) {
./$Username.ps1
}
Else {
Write-Host "$Username does not exist"
}
# Logging in
if ($Password -eq $realpass) {
get-game
}
Else {
Write-Host "Wrong Password!"
pause
Clear-Host
Log-In
}
}
答案 0 :(得分:0)