/bundles/itninjaweb/img/Breadcrumb_cap_w.png
What I'm trying to do is

If only software.exe exists only then run the command line to pull the last modified date of the dll file. 
This script below works but it posts the results from every computer.
ShellCommandtextreturn(cmd.exe /c FOR %A IN ("%ProgramFiles(x86)%\Solo\WS.dll") DO @ECHO=%~tA)

I want it to only run if the software exists on the computer. 

I'm looking for something like this below but it didn't work for me. 

ShellCommandtextreturn(if EXIST "%ProgramFiles(x86)%\SalesPad.GP\SalesPad.exe" 
cmd.exe /c FOR %A IN ("%ProgramFiles(x86)%\SalesPad.GP\SalesPad.Module.CCHSalesTaxOnlineWS.dll") DO @ECHO=%~tA)


0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Answer this question or Comment on this question for clarity

Answers

2
ShellCommandtextreturn(cmd /c if EXIST "%ProgramFiles(x86)%\SalesPad.GP\SalesPad.exe" FOR %A IN ("%ProgramFiles(x86)%\SalesPad.GP\SalesPad.Module.CCHSalesTaxOnlineWS.dll") DO @ECHO=%~tA)


any shell command to test open a cmd window and paste the portion after the /c

if EXIST "%ProgramFiles(x86)%\SalesPad.GP\SalesPad.exe" FOR %A IN ("%ProgramFiles(x86)%\SalesPad.GP\SalesPad.Module.CCHSalesTaxOnlineWS.dll") DO @ECHO=%~tA

and see if that works correctly
Answered 10/27/2016 by: SMal.tmcc
Red Belt

Please log in to comment
2

Why not just use FileInfoReturn(C:\Program Files(x86)\Solo\WS.dll, ModifiedDate, date)?

If the computer doesn't have the file then it won't show up in the list of custom inventory fields. 


Answered 10/28/2016 by: chucksteel
Red Belt

Please log in to comment
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share