NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Batch file with quotation marks in TestStand not working

Hello,

 

I am trying to run a batch file in a TestStand sequence that uses Image Magick to convert BMP images to JPG images. The content of the batch file is:
for %%f in ("F:\Reports\Test Folder\Captured Images\*.bmp") do ( convert "%%f" "F:\Reports\Test Folder\Captured Images\%%~nf.jpg" )

 

When I run this directly from a command line prompt (Windows XP or Windows Server 2012) it works great. When I call it in TestStand using the Call Executable step I get an error:

"Invalid Parameter - Folder\Captured".

 

In other words, it doesn't seem to see the quotation marks and blows up on the first space. BUT, even when run from TestStand the quotation marks do appear in the CMD window echo of what it is trying to run. The echo appears to be the same whether I run it from a command prompt or TestStand, it just doesn't work in TestStand.

 

Anyone know why this is having a problem?

0 Kudos
Message 1 of 5
(4,394 Views)

Hi Raydur,

 

TestStand sometimes requires double quotation marks when evaluating strings. More information on that property can be found here: http://digital.ni.com/public.nsf/allkb/78D9AC8EA0C9E978862576CC007825AC

Did you try using double quotations and seeing if that helped your issue?

Sunayna R.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 5
(4,349 Views)

on the path try to use \\ 

 

this is an example of a call i do to rrun the Call Executable step

 

"/k C:\\sikuly1.1\\runsikulix.cmd -r C:\\Tfs_Hal\Workspace\Applications\\TestStand\\WssTest\\Sikuly\\TakeScreenShot.sikuli --args "+ Parameters.PicName+" "+Parameters.PathForPic

CLAD, CTD
0 Kudos
Message 3 of 5
(4,320 Views)

Hi Sunayna,

 

Just to be clear, TestStand is calling a .bat file using the Call Executable step type. This passes in a path (which cannot contain quotation marks). There are no arguments (empty string). The command prompt opens and the .bat file does execute, so it is finding it properly.

 

The behavior is that when I run the batch file directly (from a command prompt, or just double-click on it) it works fine. When TestStand opens the command prompt and runs the batch file then the code inside the batch file complains like it is not seeing the quotes within the batch file (even though they are there and are shown when trying to execute).

 

To summarize:

Call the batch file manually (double-click) and it works fine.

Call it from TestStand and it executes, but the codes inside the batch file acts like it doesn't have quotation marks on the paths that contain spaces.

 

Very odd behavior!

0 Kudos
Message 4 of 5
(4,291 Views)

Hi Raydur,

 

I agree - that is very strange! Did you try the double slashes in the path, as buton suggested? I think it might be a syntax issue you're running into here.

Sunayna R.
Applications Engineering
National Instruments
0 Kudos
Message 5 of 5
(4,268 Views)