+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
Scripts Thread, Script to check if folder exists, if not, run a exe file in Coding and Web Development; I need a request for a script similar to my last one. I need this script to look for a ...
  1. #1
    tosca925's Avatar
    Join Date
    Aug 2005
    Location
    Midlands
    Posts
    1,547
    Thank Post
    4
    Thanked 4 Times in 4 Posts
    Rep Power
    22

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

    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.?

  2. #2
    Norphy's Avatar
    Join Date
    Jan 2006
    Location
    Harpenden
    Posts
    2,365
    Thank Post
    54
    Thanked 309 Times in 240 Posts
    Blog Entries
    6
    Rep Power
    119

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

    Code:
    if exist "C:\windows\system32\foldername" goto end
    \\servername\folder\software.exe
    
    :end
    Should do it

  3. #3
    tosca925's Avatar
    Join Date
    Aug 2005
    Location
    Midlands
    Posts
    1,547
    Thank Post
    4
    Thanked 4 Times in 4 Posts
    Rep Power
    22

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

    drop the above in a .bat file?

  4. #4
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    5,011
    Thank Post
    120
    Thanked 282 Times in 260 Posts
    Rep Power
    108

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

    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

  5. #5
    tosca925's Avatar
    Join Date
    Aug 2005
    Location
    Midlands
    Posts
    1,547
    Thank Post
    4
    Thanked 4 Times in 4 Posts
    Rep Power
    22

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

    @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

  6. #6

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,599
    Thank Post
    109
    Thanked 765 Times in 596 Posts
    Rep Power
    181

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

    @tosca925: Check out the Scripting Centre over at 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).

  7. #7
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    5,011
    Thank Post
    120
    Thanked 282 Times in 260 Posts
    Rep Power
    108

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

    Theres a few resources listed in the scripting forum as well here

  8. #8

    SpuffMonkey's Avatar
    Join Date
    Jul 2005
    Posts
    2,240
    Thank Post
    55
    Thanked 278 Times in 186 Posts
    Rep Power
    134

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

    I found Steve Rochford's Scripting 101 course that he gave at the Edugeek conference extremely useful - don't know if he'd be willing to let you have a copy?

  9. #9

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,784
    Thank Post
    3,291
    Thanked 1,054 Times in 975 Posts
    Rep Power
    365

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

    any chance I could get a copy of that, after all it is christmas ? LOL

  10. #10

    GrumbleDook's Avatar
    Join Date
    Jul 2005
    Location
    Gosport, Hampshire
    Posts
    9,939
    Thank Post
    1,343
    Thanked 1,787 Times in 1,110 Posts
    Blog Entries
    19
    Rep Power
    595

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

    Resources are still available on the conference website.

  11. #11

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,784
    Thank Post
    3,291
    Thanked 1,054 Times in 975 Posts
    Rep Power
    365

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

    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

  12. #12

    Join Date
    Sep 2006
    Location
    Bath, BANES
    Posts
    19
    Thank Post
    2
    Thanked 1 Time in 1 Post
    Rep Power
    0

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

    Quote Originally Posted by GrumbleDook
    Resources are still available on the conference website.
    http://www.edugeekconference.net/ind...id=7&Itemid=59

    Is that where the resources are? I cannae see them!

  13. #13

    GrumbleDook's Avatar
    Join Date
    Jul 2005
    Location
    Gosport, Hampshire
    Posts
    9,939
    Thank Post
    1,343
    Thanked 1,787 Times in 1,110 Posts
    Blog Entries
    19
    Rep Power
    595

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

    Apologies ... most of the first conference is still held on the Wiki ...

    a direct link to the 2005 conference is here and the scripting resources are here

  14. #14

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,821
    Thank Post
    1,476
    Thanked 593 Times in 445 Posts
    Rep Power
    168

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

    @tosca925
    I've found AutoIt very simple to get into and I also use WPkg to deploy some applications and it has inbuilt folder/file checking to decide whether to isntall software or not.

    regards

    Simon

  15. #15

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115

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

    Quote Originally Posted by gecko
    const Folder_Path = "c:\windows\system32\foldername"
    <snip>
    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 <somepath> <dosomething>

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. PHP IMAP check mail script
    By netadmin in forum Web Development
    Replies: 2
    Last Post: 22nd April 2007, 03:47 AM
  2. Replies: 4
    Last Post: 25th December 2006, 09:15 PM
  3. VB Script ti check for folder and then copy contents to PC
    By tosca925 in forum How do you do....it?
    Replies: 4
    Last Post: 2nd October 2006, 08:15 PM
  4. Replies: 4
    Last Post: 23rd March 2006, 06:27 AM
  5. Replies: 3
    Last Post: 1st March 2006, 12:08 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •