NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Deployment using Custom Commands

Howdy all,
 
I'm trying to create customized shortcuts to the Test Executive User Interface other than the default one(s) available to the Deployment utility. I found a way to do this without having to download a separate application or add-on using the VBScript capabilities in Windows/XP. The problem I'm having is that the deployment utility will execute the batch file, but returns an exit code of 1. when I run the batch file manually, it works just fine. I'm using TestStand 3.5 and a modified version of the Deployment utility that doesn't update sequence paths, but that should not have an effect on this.
 
My batch file consists of the following lines:
ECHO OFF
ECHO Creating a shortcut using VBScript
PAUSE
CreateShortcut.vbs
ECHO Shortcut creation complete...
PAUSE
My VBScript file CreateShortcut.vbs consists of the following lines:
Set oWS = WScript.CreateObject("WScript.Shell")
strMyPath = oWS.SpecialFolders("AllUsersStartMenu")
  
sLinkFile = strMyPath & "\My Test Executive.LNK"
  
Set oLink = oWS.CreateShortcut(sLinkFile)
  
oLink.TargetPath = "C:\My Programs\Bin\TestExec.EXE"
oLink.Arguments = "-useExisting"
oLink.Description = "My Test Executive (Only)"
' oLink.HotKey = ""
' oLink.IconLocation = "C:\My Programs\Bin\TestExec.EXE, 2"
' oLink.WindowStyle = "1"
' oLink.WorkingDirectory = "C:\My Programs\Sequences"
oLink.Save
When I run this using the deployment tool I get the following message when the batch file tries to execute the CreateShortcut.vbs file:
'CreateShortcut.vbs' is not recognized as an internal or external command, operable program or batch file.
Can anyone explain to me why this doesn't want to work in the Deployment tool, but it does work if I run it manually?
 
Thanks,
 
-Jack
0 Kudos
Message 1 of 4
(4,355 Views)

Capt. Jack

vbscript executes by calling wscript.exe

So you need to execute <path>\wscript.exe <path>\your_vbscript.vbs

Hope it helps.

Antonio Lie.

Message 2 of 4
(4,343 Views)

Antonio,

Your suggestion helped me figure out what is going on. I believe there may be a feature/bug in the way the Deployment utility runs commands. I'm having the files installed in the Temp directory Installation Destination and using the <Temp> Command Directory in the Custom Commands to tell it where the files are to execute. This temp directory path resolves to "C:\Documents and Settings\<User Account>\Local Settings\Temp\". I neglected to add the path to the CreateShortcut.vbs file because I assumed that the batch file could find it since it's in the same directory as the batch file. But for some reason, it is looking for the file on the Installer drive and path for Setup.exe (see attached file), instead of the <Temp> path. This may be default windows behavior, but it seems odd that this is what happens.

I was able to get this to work using the "%USERPROFILE%\Local Settings\Temp\CreateShortcut.vbs" in the batch file.

Thanks for getting me going down the right road!

-Jack

0 Kudos
Message 3 of 4
(4,334 Views)
Jack,
 
I am glad you figured it out.
Currently there is not way to specify the working directory for an specific command, as you already realized the working directory is set to the installer directory by default.
I think being able to specify the working directory besides the command directory would be a nice feature to have.
I will submit a suggestion to the TestStand team.
 
Best Regards.
 
Antonio Lie
0 Kudos
Message 4 of 4
(4,310 Views)