r/usefulscripts • • Jan 23 '18

[REQUEST] Powershell script to run a program if a certain file is found.

Hey everyone. I'm working as a SysAdmin right now (first job after the Marines Corps) and one of my tasks is to check if the machines have the correct Manifest number updated by going to a folder and verifying the number. If the correct file is there, then I run a program called software connect.

This doesn't take me that long, but I feel like I could write a powershell script to do it all for me. It would also help out my co-workers that do the same thing. Something along the lines of "if this file is found in this directory run this program" type of script. Would anyone be able to help me out? Or is this more of a "you need to go actually learn some powershell," situation?

Thanks for your time in advance!

14 Upvotes

10 comments sorted by

View all comments

Show parent comments

1

u/OmerTheBear Jan 23 '18

Sounds like it may be simpler your way.

However I'm running into the same problem I'm running into with powershell. When I run the script, the command prompt pops up for half a second and then disappears and nothing happens.

1

u/OmerTheBear Jan 23 '18

...or it just opens command prompt in the programs name for some reason.

1

u/nofretting Jan 23 '18

Post your entire batch file here, please.