Invoke Power shell Activity CommandNotFound Error

Hi, I have a question power shell problem.
I want to print file(C:\test_1.txt), so i used Invoke Power shell Activity and wrote to Commandtext like this :
“Start-Process -FilePath test_1.txt -WorkingDirectory C: -Verb Print”

but CommandNotFound Error occured.

Source: Invoke Power Shell (Throw)

Message: The term ‘Start-Process -FilePath test_1.txt -WorkingDirectory C:-Verb Print’ 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.

Details of Error

Exception Type: System.Management.Automation.CommandNotFoundException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Management.Automation.CommandNotFoundException: The term ‘Start-Process -FilePath test_1.txt -WorkingDirectory C:-Verb Print’ 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 System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Hi @kc120103

checking the Properties IsScript? ?

No, i didn’t. i’ll checking isScript!!

“The specified file could not be found.” Error occured:cry:
But I think file path is right(C:\test_1.txt)

Source: Invoke Power Shell (Throw)

Message: This command cannot be run due to the error: The specified file could not be found.

Exception Type: System.Management.Automation.CmdletInvocationException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Management.Automation.CmdletInvocationException: This command cannot be run due to the error: The specified file could not be found. ----> System.InvalidOperationException: This command cannot be run due to the error: The specified file could not be found.
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
— End of inner ExceptionDetail stack trace —
at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Hey?

How do you mean .txt? It should be .ps1

Cheers

What is .ps1? .txt file is notepad file

never mind!! i solved it!!
i modified the file path, then it worked!! Thank you

.ps1 is power shell file, rename your file from .txt to .ps1

You will also ge ps debugger

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.