ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Call Executable - Unexpected token

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?

 

0 Kudos
Message 1 of 7
(3,805 Views)

You need quotes around it.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 7
(3,781 Views)

Thx for your reply.

I can't figure out where to put the quotes, can you please give an example?

 

 

0 Kudos
Message 3 of 7
(3,771 Views)

"ren c:\\putty_log\\putty.log Mainboard_Str(FileGlobals.serial).txt & move c:\\putty_log\\*.txt p:\\Testreports\\Log\\"

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 4 of 7
(3,769 Views)

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.

0 Kudos
Message 5 of 7
(3,753 Views)

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.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 6 of 7
(3,730 Views)

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

0 Kudos
Message 7 of 7
(3,722 Views)