I'am using KPScript from windows CMD.
Is it possible to make multi-line Notes when use KPScript -c:AddEntry ?
I can't find character, that will send "new line".
This was not possible, but I've added it now. The parameters for specifying new field data (for the 'AddEntry' and the 'EditEntry' command) now support escape sequences (e.g. '\n' is replaced by a new-line character).
Escape sequences are supported for all fields. Adding an exception for the user name field would be inconsistent and limit functionality (what if you want a Tab in the user name field?); I'm not going to do that.
If you want to specify domain\testuser as user name, pass domain\\testuser to KPScript, i.e. replace single backslashes by double ones.
Best regards,
Dominik
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
Necropost)))
I also got issue with ** \t**:
I'm using this command line: KPScript.exe -c:AddEntry "C:\Safe1.kdbx" "-pw:123" "-Title:symbols test" -UserName:"OU\\user\\test" -Password:test\\this\\symbol
In case if after \\ going "u" or "s" (for example) - everything works fine, but if after \\ is going "t" i've got troubles.
Added screenshot with results of this command in GUI.
I can confirm the behaviour in KPScript 2.39.1. Double slashes before "t" \\t cause a Tab character to be inserted in the entry.
I've tried single, double and triple slashes, with and without surrounding quotes.
cheers, Paul
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello again)))
I think I've found one more issue:
if password (for example, I think this will be actual for all fields) contains \" I can't find the right way to send these symbols. I've tried:
\"
\\"
\\\"
I expected that \\\" should work correctly (one backslash for backslash and one for quote), but no.
If i,m using command:
From a KPScript point of view, there's nothing special about quotes; you need to encode them according to the rules of your terminal. On Windows, a quote is typically encoded using 3 quotes (see [1]).
As discussed, a single backslash must be encoded by 2 backslashes for KPScript. However, note that the terminal may also interpret backslashes, and this may not be consistent or obvious. For example, Cmd.exe doesn't reinterpret 2 backslashes followed by an A (i.e. the target application gets 2 backslashes followed by an A in the command line parameters), but 2 backslashes followed by a quote is changed to 1 backslash only, and 2 backslashes followed by 3 quotes is changed to 1 backslash and 1 quote only (this can be seen with an actual application, not necessarily with built-in commands like ECHO). So, Cmd.exe sometimes treats a backslash as an escape character and sometimes not. In the case when a quote follows, it is treated as escape character.
Consequently, the encoding of 1 backslash followed by 1 quote for KPScript/Cmd.exe is 4 backslashes followed by 3 quotes.
When using other commands (actual for ChangeMasterKey, at least) those rules doesn't work. Terminal is the same.
Cases:
KPScript '-c:ChangeMasterKey' "C:\Test.kdbx" '-pw:easy' '-newpw:pa"ss\wo\"rd'
New PW will be: pass\wo"rd
KPScript '-c:ChangeMasterKey' "C:\Test.kdbx" '-pw:easy' '-newpw:pa\"ss\\wo\\\\"""rd'
New PW will be: pa"ss\\wo\\"rd
KPScript '-c:ChangeMasterKey' "C:\Test.kdbx" '-pw:easy' '-newpw:pa\"ss\wo\\\"rd'
New PW will be: pa"ss\wo\"rd
KPScript '-c:ChangeMasterKey' "C:\Test.kdbx" '-pw:easy' '-newpw:pa\"ss\wo\\"rd'
New PW will be: pa"ss\wo\rd
So i don't understand: are the encoding rules different for different KPScript commands?
Also, i think i,ve find bug:
If run from cmd (there is no -pw parameter): KPScript.exe '-c:ChangeMasterKey' "C:\Test.kdbx" 'pa\"ss\wo\rd' '-newpw:pa\"ss\wo\\""rd'
the output will be: OK: Operation completed successfully., but password change do not happens.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Cmd.exe doesn't support single quotes ('); you must use double quotes (").
KPScript typically interprets a backslash as escape character only for entry field value parameters. For the master key changing command, it's not interpreted as escape character (the master password must not contain newlines anyway).
Best regards,
Dominik
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
I'am using KPScript from windows CMD.
Is it possible to make multi-line Notes when use KPScript -c:AddEntry ?
I can't find character, that will send "new line".
I've allready tried:
And some more options, but didn't reach needed result.
Last edit: Kirill B. 2015-07-13
This was not possible, but I've added it now. The parameters for specifying new field data (for the 'AddEntry' and the 'EditEntry' command) now support escape sequences (e.g. '\n' is replaced by a new-line character).
Here's the latest KPScript development snapshot for testing:
http://keepass.info/filepool/KPScript_150713b.zip
Thanks and best regards,
Dominik
I've tested. Works fine. Thanks a lot!
when adding usernames with domain beginning with "t" this also gets escaped
"domain\testuser"
could you update KPScript.exe to not escape anything for usernames?
KR
Guenther
Escape sequences are supported for all fields. Adding an exception for the user name field would be inconsistent and limit functionality (what if you want a Tab in the user name field?); I'm not going to do that.
If you want to specify
domain\testuseras user name, passdomain\\testuserto KPScript, i.e. replace single backslashes by double ones.Best regards,
Dominik
Hello!
Necropost)))
I also got issue with ** \t**:
I'm using this command line:
KPScript.exe -c:AddEntry "C:\Safe1.kdbx" "-pw:123" "-Title:symbols test" -UserName:"OU\\user\\test" -Password:test\\this\\symbolIn case if after
\\going "u" or "s" (for example) - everything works fine, but if after\\is going "t" i've got troubles.Added screenshot with results of this command in GUI.
Last edit: Kirill B. 2018-06-18
This is the intended behavior. If you want a literal \, specify
\\.Best regards,
Dominik
Last edit: Dominik Reichl 2018-06-18
hm... sourceforge eated double backslash.
if use OU"double backslash"user"double backslash"test in result i've got (like in screenshot):
OU\user est
updated post with commands
so, the trouble:
\\twill bee tab in KPScript, but not \tLast edit: Kirill B. 2018-06-18
I can confirm the behaviour in KPScript 2.39.1. Double slashes before "t"
\\tcause a Tab character to be inserted in the entry.I've tried single, double and triple slashes, with and without surrounding quotes.
cheers, Paul
I've fixed it. Thanks for reporting this issue!
Here's the latest KPScript development snapshot for testing:
https://keepass.info/filepool/KPScript_180618.zip
Best regards,
Dominik
Now working as expected.
Thank you a lot again!
Hello again)))
I think I've found one more issue:
if password (for example, I think this will be actual for all fields) contains
\"I can't find the right way to send these symbols. I've tried:\"\\"\\\"I expected that
\\\"should work correctly (one backslash for backslash and one for quote), but no.If i,m using command:
in database will be password:
pass"wordIs this true issue or i do something wrong?
Last edit: Kirill B. 2018-06-22
From a KPScript point of view, there's nothing special about quotes; you need to encode them according to the rules of your terminal. On Windows, a quote is typically encoded using 3 quotes (see [1]).
As discussed, a single backslash must be encoded by 2 backslashes for KPScript. However, note that the terminal may also interpret backslashes, and this may not be consistent or obvious. For example, Cmd.exe doesn't reinterpret 2 backslashes followed by an A (i.e. the target application gets 2 backslashes followed by an A in the command line parameters), but 2 backslashes followed by a quote is changed to 1 backslash only, and 2 backslashes followed by 3 quotes is changed to 1 backslash and 1 quote only (this can be seen with an actual application, not necessarily with built-in commands like ECHO). So, Cmd.exe sometimes treats a backslash as an escape character and sometimes not. In the case when a quote follows, it is treated as escape character.
Consequently, the encoding of 1 backslash followed by 1 quote for KPScript/Cmd.exe is 4 backslashes followed by 3 quotes.
Best regards,
Dominik
[1] https://msdn.microsoft.com/en-us/library/windows/desktop/bb759784.aspx
Hello!
When using other commands (actual for ChangeMasterKey, at least) those rules doesn't work. Terminal is the same.
Cases:
KPScript '-c:ChangeMasterKey' "C:\Test.kdbx" '-pw:easy' '-newpw:pa"ss\wo\"rd'New PW will be:
pass\wo"rdKPScript '-c:ChangeMasterKey' "C:\Test.kdbx" '-pw:easy' '-newpw:pa\"ss\\wo\\\\"""rd'New PW will be:
pa"ss\\wo\\"rdKPScript '-c:ChangeMasterKey' "C:\Test.kdbx" '-pw:easy' '-newpw:pa\"ss\wo\\\"rd'New PW will be:
pa"ss\wo\"rdKPScript '-c:ChangeMasterKey' "C:\Test.kdbx" '-pw:easy' '-newpw:pa\"ss\wo\\"rd'New PW will be:
pa"ss\wo\rdSo i don't understand: are the encoding rules different for different KPScript commands?
Also, i think i,ve find bug:
If run from cmd (there is no
-pwparameter):KPScript.exe '-c:ChangeMasterKey' "C:\Test.kdbx" 'pa\"ss\wo\rd' '-newpw:pa\"ss\wo\\""rd'the output will be:
OK: Operation completed successfully., but password change do not happens.Cmd.exe doesn't support single quotes (
'); you must use double quotes (").KPScript typically interprets a backslash as escape character only for entry field value parameters. For the master key changing command, it's not interpreted as escape character (the master password must not contain newlines anyway).
Best regards,
Dominik