我是powerscripting的新手,并且有两个powerscritps,其中runWin1.ps1调用runWin2.ps1。
runWin1.ps1
代码:
cd D:\Powershell_scripts
Start-Process Powershell.exe '.\runWin2.ps1 181 0'
Start-Process Powershell.exe '.\runWin2.ps1 181 22.5'
Start-Process Powershell.exe '.\runWin2.ps1 181 75'
runWin2.ps1
代码:
#Write-Host 'Case: Wt=', $args[0], 'Gle=', $args[1]
$filePath = "D:\batch_runs\Run" + $args[0] + $args[1]
Set-Location $filePath
Invoke-Expression D:\eps.exe
我正在从PowerShell控制台或cmd窗口运行runWin1.ps1
。使用这两段代码,一切都运行正常,然后我突然开始收到此错误消息
# : The term ' #' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\Powershell_scripts\runWin2.ps1:1 char:1
+ # W r i t e - H o s t ' C a s e : W t = ' , $ a r g s [ 0 ] , ' ...
+ ~~
+ CategoryInfo : ObjectNotFound: ( #:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
: The term ' ' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\Powershell_scripts\runWin2.ps1:2 char:1
+
+ ~
+ CategoryInfo : ObjectNotFound: ( :String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
$ : The term ' $' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\Powershell_scripts\runWin2.ps1:3 char:1
+ $ f i l e P a t h = " D : \ S e c u r e P r o j e c t s \ D D A M _ X \ D D ...
+ ~~
+ CategoryInfo : ObjectNotFound: ( $:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
: The term ' ' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\Powershell_scripts\runWin2.ps1:4 char:1
+
+ ~
+ CategoryInfo : ObjectNotFound: ( :String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
S : The term ' S' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\Powershell_scripts\runWin2.ps1:5 char:1
+ S e t - L o c a t i o n $ f i l e P a t h
+ ~~
+ CategoryInfo : ObjectNotFound: ( S:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
: The term ' ' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\Powershell_scripts\runWin2.ps1:6 char:1
+
+ ~
+ CategoryInfo : ObjectNotFound: ( :String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
$ : The term ' $' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\Powershell_scripts\runWin2.ps1:7 char:1
+ $ p w d
+ ~~
+ CategoryInfo : ObjectNotFound: ( $:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
: The term ' ' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\Powershell_scripts\runWin2.ps1:8 char:1
+
+ ~
+ CategoryInfo : ObjectNotFound: ( :String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I : The term ' I' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\P_powershell_scripts\runWin2.ps1:9 char:1
+ I n v o k e - E x p r e s s i o n D : \ S e c u r e P r o j e c t s \ D D A M ...
+ ~~
+ CategoryInfo : ObjectNotFound: ( I:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
: The term ' ' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\Powershell_scripts\runWin2.ps1:10 char:1
+
+ ~
+ CategoryInfo : ObjectNotFound: ( :String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException