+ Post New Thread
Results 1 to 6 of 6
Scripts Thread, VBS Drive script is running from in Coding and Web Development; Hi there I'm writing a bunch of scripts to make certain tasks easier. These scripts are all located on my ...
  1. #1
    Samson's Avatar
    Join Date
    Mar 2007
    Location
    Wales
    Posts
    201
    Thank Post
    7
    Thanked 1 Time in 1 Post
    Rep Power
    17

    VBS Drive script is running from

    Hi there

    I'm writing a bunch of scripts to make certain tasks easier.

    These scripts are all located on my USB pen drive, the problem is that in some computers my pen drive shows up as H:, some as D: some as E: etc etc, and some of the scripts that involve various file manipulations require the drive letter of the USB stick.

    Is there a way of getting the the drive letter of the drive the script is running from into a variable in VBS?

    Cheers.

  2. #2

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,628
    Thank Post
    747
    Thanked 1,707 Times in 1,520 Posts
    Rep Power
    437

    Re: VBS Drive script is running from

    or use usbdlm to set the drive letter?

    Ben

  3. #3
    Samson's Avatar
    Join Date
    Mar 2007
    Location
    Wales
    Posts
    201
    Thank Post
    7
    Thanked 1 Time in 1 Post
    Rep Power
    17

    Re: VBS Drive script is running from

    It'd be much easier to just have my script get the current drive letter.

  4. #4

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,417
    Thank Post
    644
    Thanked 965 Times in 665 Posts
    Blog Entries
    2
    Rep Power
    328

    Re: VBS Drive script is running from

    Using WScript.ScriptFullName will return the full path to the script - you can get the drive letter from this.

    Code:
    strPath = WScript.ScriptFullName
    arrPath = Split(strPath, ":")
    strDrive = arrPath(0)

  5. #5

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,993
    Thank Post
    3,539
    Thanked 1,110 Times in 1,016 Posts
    Rep Power
    374

    Re: VBS Drive script is running from

    beat me to it and you used the split function hehe

  6. #6
    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: VBS Drive script is running from

    USBdlm all the way here.



SHARE:
+ Post New Thread

Similar Threads

  1. Permissions on your simsroot/sims drive/s: drive
    By Oops_my_bad in forum MIS Systems
    Replies: 3
    Last Post: 30th August 2014, 10:41 PM
  2. Replies: 3
    Last Post: 25th October 2007, 10:14 AM
  3. Running flash based content from shared drive over RM CC3?
    By dinsyboy in forum Network and Classroom Management
    Replies: 0
    Last Post: 13th October 2007, 07:03 PM
  4. Replies: 7
    Last Post: 8th July 2007, 10:40 PM
  5. Printer script not running at start up
    By richard in forum Scripts
    Replies: 11
    Last Post: 29th May 2007, 08:39 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
  •