12-20-2017 04:55 AM
Hi all
In Teststand Call Executable im trying to use the cmd.exe with the follow argument:
ren c:\\putty_log\\putty.log Mainboard_Str(FileGlobals.serial).txt & move c:\\putty_log\\*.txt p:\\Testreports\\Log\\
But i keep getting "Unexpected token".
If i put the argument in a .bat file and manually enter the serial(number) it Works fine.
Can anyone please tell me what im missing in the argument?
12-20-2017 10:15 AM
You need quotes around it.
12-21-2017 12:23 AM
Thx for your reply.
I can't figure out where to put the quotes, can you please give an example?
12-21-2017 12:27 AM
"ren c:\\putty_log\\putty.log Mainboard_Str(FileGlobals.serial).txt & move c:\\putty_log\\*.txt p:\\Testreports\\Log\\"
12-28-2017 01:22 AM
When adding the quotes in the beginning and the end, it is handled by teststand as a text string. Teststand will handle my variable (FileGlobals.serial) as text and not a variable.
So if i use quotes at both ends my filename will end up like this:
Mainboard_Str(FileGlobals.serial).txt
But, my intension was to end up with this (If my serialnumber is 1234):
Mainboard_1234.txt
I gave up on the call executable to do this alone, and instead created a .bat with the same cmd line and replaced the Str(FileGlobals.serial) with a %1, batch file now looks like this:
ren c:\putty_log\putty.log Mainboard_%1.txt & move c:\putty_log\*.txt p:\Testreports\Log\
I use call executable to call the .bat with FileGlobals.serial as argument.
This Works and is my solution.
01-02-2018 12:28 AM - edited 01-02-2018 12:29 AM
That's my bad. I didn't see that you had a variable in your string. This should work in TestStand:
"ren c:\putty_log\putty.log Mainboard_" + Str(FileGlobals.serial) + ".txt & move c:\putty_log\*.txt p:\Testreports\Log\"
Expressions in TestStand follow the C style syntax.
01-02-2018 10:06 AM
Doubling backslashes should only be done in expressions. When you are setting the value of a string variable that is not an expression, you should not double the backslashes and should instead just have single backslashes.
Hope this helps,
-Doug