cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
777
Views
0
Helpful
2
Replies

Check file exists

STOps9487
Level 1
Level 1

What's the best way to check that a file exists?

I notice there is no built in check for this, so what do most people do?

Is it best to just execute "if not exists" and exit with a non zero code?

Example:

if not exist C:\windows\regedit.exe exit /b 1

1 Accepted Solution

Accepted Solutions

Shaun Roberts
Cisco Employee
Cisco Employee

Yes, there is no built-in function so it's best to use scripting of some form, either VBS and use the execute windows script activity or use powershell and use the execute powershell activity.

I do this for a lot of stuff that is not already coded in CPO and works fine.

--Shaun Roberts
Principal Engineer, CX
shaurobe@cisco.com

View solution in original post

2 Replies 2

Shaun Roberts
Cisco Employee
Cisco Employee

Yes, there is no built-in function so it's best to use scripting of some form, either VBS and use the execute windows script activity or use powershell and use the execute powershell activity.

I do this for a lot of stuff that is not already coded in CPO and works fine.

--Shaun Roberts
Principal Engineer, CX
shaurobe@cisco.com

Thanks Chris - the cmd I posted in my original message seems to be working OK.

Review Cisco Networking for a $25 gift card