1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

.bat file to open a folder

Discussion in 'Windows XP' started by lightnb, Jan 7, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. lightnb

    lightnb Thread Starter

    Joined:
    Jun 16, 2002
    Messages:
    786
    I tried searching Google, but it just gave me pages of irrelevant junk....

    I need to create a batch file, that when envoked opens a "windows Explorer" window, and goes to a specified folder. Anyone know what code will do this?

    Thanks,

    Nick
     
  2. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,409
    %SystemRoot%\explorer.exe "folder path"

    where "folder path" is the complete folder path in quotes.
     
  3. lightnb

    lightnb Thread Starter

    Joined:
    Jun 16, 2002
    Messages:
    786
    Excellent. Thank you. :)

    I'm having an issue with my other bat file as well:

    Code:
    start ../include/SP/ELM/Elemental Paperwork/Lighting/ELM_plot.mcd
    The space in the folder name seems to be interfering...
     
  4. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,409
    Put quotes around the entire name. :)
     
  5. lightnb

    lightnb Thread Starter

    Joined:
    Jun 16, 2002
    Messages:
    786
    I have:

    But all it does is open a command prompt, at the folder where the bat file is located...
     
  6. Frank4d

    Frank4d Trusted Advisor

    Joined:
    Sep 10, 2006
    Messages:
    9,126
    Are you trying to run a batch file from within another batch file? I recently had a problem with this until I remembered to CALL the second batch file from within the first.
     
  7. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,409
    What do you expect it to do? Are you trying to launch the application associated with the file extension .MCD? You can invoke it with the file as a parameter on the command line in many cases.
     
  8. lightnb

    lightnb Thread Starter

    Joined:
    Jun 16, 2002
    Messages:
    786
    It should open the file using the default program (Vectorworks).

    works, because there are no spaces.

    But if the folder name is "Elemental Paperwork" not "ElementalPaperwork" the space in the folder name causes the command to fail.

    Is there a way to make it work with spaces in the folder names?
     
  9. Frank4d

    Frank4d Trusted Advisor

    Joined:
    Sep 10, 2006
    Messages:
    9,126
    What happens if you enclose the entire drive/path/filename in quotes? It should work.
     
  10. JohnWill

    JohnWill Retired Moderator

    Joined:
    Oct 19, 2002
    Messages:
    106,409
    You mean like I suggested in post #4? :D
     
  11. lightnb

    lightnb Thread Starter

    Joined:
    Jun 16, 2002
    Messages:
    786
    It just opens a command prompt for some reason....
     
  12. Frank4d

    Frank4d Trusted Advisor

    Joined:
    Sep 10, 2006
    Messages:
    9,126
    Move the first quote mark.
    Use this: start .."/include/SP/ELM/Elemental Paperwork/Lighting/ELM_plot.mcd"
    Not this: start "../include/SP/ELM/Elemental Paperwork/Lighting/ELM_plot.mcd"
     
  13. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/533204