Jump to content

Script to check if folder exists, if not, run a exe file


Recommended Posts

Posted

I need a request for a script similar to my last one.

 

I need this script to look for a folder in

 

c:\windows\system32\foldername.

 

If this folder exists then i want the script to stop. If the folder does not exist then i want the script to run a .exe file from the server toinstall a piece of software. ie

 

\\servername\folder\software.exe.

 

There will be file sin the folder in c:\windows\system32\foldername but i only wnat it to look at the folder not its contents.

 

Any suggestions please.?

Posted

Yes put it in a bat or cmd file.

I couldnt be doing without my scripting skills these days it saves you so much time and manual effort it's well worth putting the time in to learn :)

Posted

@ChrisH

 

I'd love to learn Chris, have you any recomendations for me to start as a beginner? Books or web sites?

 

I need basic on all sorts of scripting. I have lots of very useful scripts but i have only experience of tweaking other peoples scripts. lol

Posted
@tosca925: Check out the Scripting Centre over at http://www.technet.com - IMHO the best place to start learning. Lots of examples and you can download a help file with the vast majority of the functions that you need - copy and paste and hack to begin with and eventually you'll be able to start from scratch (when necessary).
  • 8 months later...
Posted

const Folder_Path = "c:\windows\system32\foldername"

const Exe = "\\servername\folder\software.exe"

 

Set FSO = CreateObject("Scripting.FileSystemObject")

Set WshShell = CreateObject("WScript.Shell")

 

If FSO.FolderExists(Folder_Path) = true then

Wscript.Quit

Else

WshShell.Run Exe

EndIf

Posted
const Folder_Path = "c:\windows\system32\foldername"

 

Less is more.. if you can do it with one line of batch file then that's usually the way to go. I'd do the one above, but with a "not":

 

if not exist

  • 3 years later...
Posted (edited)

hey guys... i need help writing a script to convert files from raw to wav. I am using a tool named raw2wav.exe to convert/merge 2-file/2-way audio into a single wav file. The utility automaticly checks to see if files exist in the destination directory and does not convert them...

 

c:\

cd c:\program files\cisco\desktop\bin

for %%c in (..\..\desktop_audio\*.raw) do raw2wav "%%~nc%%~xc"

 

is there a way to add to this batch so the tool converts only files that have a create date of today?

 

just to mention... the file names of the raw files containt a timestamp in the and the naming is:

 

.To/From.raw

Edited by kenchisho

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...