• 0

[VBScript] Change working directory


Question

I store several portable applications on my external drive and I use a VBScript to launch a select few of them. Heres what the script looks like:

Set WSHShell = WScript.CreateObject("WScript.Shell")
LaunchDir = WSHShell.CurrentDirectory

wSHShell.Run """" & LaunchDir & "\Applications\PrivaZer\PrivaZer.exe"

Unfortunately, this script does not work well for PrivaZer. I need a way to change the working directory to E:\Applications\PrivaZer\ first before launching the program. However I do not want to hardcode the letter of my drive since it may change depending on the machine I'm on. Any ideas?

Link to comment
https://www.neowin.net/forum/topic/1155804-vbscript-change-working-directory/
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Maybe this might work

Set WSHShell = WScript.CreateObject("WScript.Shell")

Dim App :App = WSHShell.CurrentDirectory & "\Applications\PrivaZer\PrivaZer.exe"

WSHShell.CurrentDirectory=Replace(App,"\PrivaZer.exe","")

WSHShell.Run(App),1,True

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • My problem with FF is I have to jump through hoops to get at least somewhat close to what Vivaldi gives me out of the box, with no real advantage that would make it worth my while. (But hey, apparently there's now at least experimental support for HDR in FF. I mean it's about a decade too late, but still...finally!) Brave I was never the least interested in, never saw the point, not to mention there's been quite a bit of drama surrounding them over the years. But I've been a faithful and very happy Opera user all the way back to 2001(ish), so once Vivaldi showed up following that awkward period of time after the key people left Opera and the company was sold, I never really looked back. And they never once made me question my choices.
    • Need to dust it again dangit, come on McDonalds, do your thing !?
    • I see it has more memory, more storage, a better CPU, and a stylus, as you said. Might be a good alternative. I see some refurbished for $150-200. I'm not scared of refurnbished, as a lot of parts in my house are refurbished/used. All are working atm.
    • "TeamViewer is the fast, simple and friendly solution for remote access over the Internet" Regarding the "friendly" description, has is stopped unceremoniusly booting your session after a couple of minutes accusing you of using it in a commercial environment?!
  • Recent Achievements

    • One Month Later
      Sopa flores earned a badge
      One Month Later
    • First Post
      StaticMatrix earned a badge
      First Post
    • Week One Done
      StaticMatrix earned a badge
      Week One Done
    • Rookie
      lamborghiniv10 went up a rank
      Rookie
    • One Month Later
      pinnclepd earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      506
    2. 2
      PsYcHoKiLLa
      205
    3. 3
      +Edouard
      155
    4. 4
      Steven P.
      91
    5. 5
      ATLien_0
      79
  • Tell a friend

    Love Neowin? Tell a friend!