Open z1rt opened 1 year ago
Hi @z1rt I assume this is powershell? Could it be, that you are passing parameters to other scripts/programs without quoting them? Script server doesn't do any preprocessing and passes values as it is.
HI! Yes, I pass parameters from the input field to the powershell script. Can you tell me how to process the string in this case so that there is no error?
I don't know much about powershell and your script. But one of the first things to check is that you always wrap all the parameters in quotes inside the script, e.g.
Bad
echo $myField
Good
echo "$myField"
Sorry if it sounds obvious, but this is the most common issue I saw.
The problem is not in the powershell script, but in the fact that the input field on the interface of your script server does not perceive some characters. That is, it perceives ordinary strings easily, until there is a quotation mark or a comma, for example.
The main idea of my script is to perform authorization in a powershell script, through your script interface. But I can't pass the password string, as an error occurs from the attachment.
At first I also thought about processing variables in the script itself, but it turned out that they do not pass through the interface
Do I need to do input processing in the interface?
Is it just a normal input field? Could you check in "history" section, how does a command look like?
z1rt @.***> schrieb am Mo., 17. Apr. 2023, 12:25:
The problem is not in the powershell script, but in the fact that the input field on the interface of your script server does not perceive some characters. That is, it perceives ordinary strings easily, until there is a quotation mark or a comma, for example.
The main idea of my script is to perform authorization in a powershell script, through your script interface. But I can't pass the password string, as an error occurs from the attachment.
At first I also thought about processing variables in the script itself, but it turned out that they do not pass through the interface
Do I need to do input processing in the interface?
— Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/652#issuecomment-1511088474, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJXPJL3GPM4FUMXIQMLMXLXBULDDANCNFSM6AAAAAAXAQ4UXY . You are receiving this because you commented.Message ID: @.***>
Yes, it's just a text field with the type "text"
Hey, I reproduced it locally, and you have to use -File
, instead of -Command
.
As far as I understood the difference, if you use -Command
, powershell parses all the input as a single command, it just contatinates the text from the file with '
character. And '
is a wrong command
When you use -File
, powershell just invokes this file, and passes all the subsequent parameters to this file.
Wow, thank you very much!
I need to pass any string to after for input, but the field does not accept the special characters " ', " , - as an example.