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.

How to make a VBS commmand to open a file

Discussion in 'Software Development' started by simr, Dec 16, 2013.

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

    simr Thread Starter

    Joined:
    May 12, 2013
    Messages:
    1,003
    No, what I'm saying is that by entering a Command line/Batch script or VBScript with the right code and the new target for the shortcut file (all of which is put in the script) you can change the target shortcut by clicking on the Batch file or VBS file.
     
  2. TonyB25

    TonyB25 Banned

    Joined:
    Dec 31, 1969
    Messages:
    2,540
    Yes, you can change the target of a shortcut. How does that change what happens when someone opens a folder?
     
  3. simr

    simr Thread Starter

    Joined:
    May 12, 2013
    Messages:
    1,003
    My first question was, is there a code to cause one file to be activated when another is opened. Since apparently there isn't, my next question is - what's the Command line or VBS code to change a shortcut target?

    Thanks!
     
  4. valis

    valis Moderator

    Joined:
    Sep 24, 2004
    Messages:
    77,267
    starting to wonder about the 'why' here.......
     
  5. simr

    simr Thread Starter

    Joined:
    May 12, 2013
    Messages:
    1,003
    In post #14 you have your answer Valis.
    And what do your 6 dots mean? What could the "why" be?
     
  6. valis

    valis Moderator

    Joined:
    Sep 24, 2004
    Messages:
    77,267
    it just seems to me that this is a rather unwieldy way to go about this problem.....but if you have your reasons, you have your reasons. I don't like to see .hta files run rampant, as those are easily misused.

    thanks,

    v
     
  7. TonyB25

    TonyB25 Banned

    Joined:
    Dec 31, 1969
    Messages:
    2,540
    How about you create a shortcut the way you want and then just copy it to people's computers?
     
  8. simr

    simr Thread Starter

    Joined:
    May 12, 2013
    Messages:
    1,003
    I only brought up the HTA option as a last resort if there's no way to create a batch file with a command line that could change a shortcut target. I personally like Batch files with command lines better then HTA files.

    During the day I have a shortcut desktop icon which has the target:
    "C:\Windows\nircmd.exe standby"
    Meaning when I double click it, my PC goes into standby (neat shortcut, no?).
    At night I go into the shortcut and change its target to:
    "C:\Windows\nircmd.exe hibernate"
    so that when I click it - it'll hibernate over night.
    To make things more convenient for me, I asked above if there's a way to make a Batch file or VBS file (if not than HTA as a last ditch attempt) so that instead of having to go and manually change the target every morning to "Sleep" and every evening to "Hibernate" I could just have 2 Batch files that by clicking on them I will accomplish the aforementioned tasks automatically.

    I hope I clarified myself and the purpose of my quarry.

    I thank everyone for your attempts at assisting me, though I guess I won't have such a Batch file, but that's okay, as the small things in life needn't bother anyone.
     
  9. valis

    valis Moderator

    Joined:
    Sep 24, 2004
    Messages:
    77,267
    is there a reason you don't just have two shortcuts?
     
  10. simr

    simr Thread Starter

    Joined:
    May 12, 2013
    Messages:
    1,003
    Good question valis.
    Yes, the reason is since it's a computer that a few people use and not just me, and for some people it gets a little confusing when there's too much for them to remember, I keep it simple with one icon on the desktop that they click when they're done, and I change it from day to night.
     
  11. valis

    valis Moderator

    Joined:
    Sep 24, 2004
    Messages:
    77,267
    trust me, I had a VERY similar problem, hence my questioning.......I literally had to relabel the shortcuts 1 and 2, as AM and PM wasn't getting it done.......:rolleyes:
     
  12. simr

    simr Thread Starter

    Joined:
    May 12, 2013
    Messages:
    1,003
    Right, so I have a shortcut icon on the desktop with a picture of a computer screen and a moon on it (thank windows for including many icons to choose from) to illustrate the computer sleeping, and whoever is done with the PC double clicks it. By day it makes the PC sleep, and at night - hibernate.
    Because before I started with this, people would just shut the screen when they were done (I have a laptop) and from all the shutting and opening, the screen started flickering many times, so I had to institute the current way of shutting the computer so my screen shouldn't go totally down, though I don't know how to repair the current flickering of the screen which is very annoying, aside from paying big bucks (relatively speaking for such a problem) to a repair shop which I don't want to do, since my PC is old as it is, and has many other issues as well, hence my other question forums on this wonderful website.
     
  13. valis

    valis Moderator

    Joined:
    Sep 24, 2004
    Messages:
    77,267
    so we can mark the software part finit and focus on the hardware issue, e.g., the monitor flicker? If so, I'll just move the last post and create a new thread for you....

    thanks,

    v
     
  14. simr

    simr Thread Starter

    Joined:
    May 12, 2013
    Messages:
    1,003
    Yes, screen flicker is a big problem, and very annoying... :(
     
  15. 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!

Thread Status:
Not open for further replies.

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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice