Shell Command did work fine but doesn't now.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NyNyHelp
    New Member
    • Jul 2007
    • 21

    #16
    Originally posted by hariharanmca
    I will give a better idea

    Code:
    open the file path through internet explorer (Don’t open file)
    Copy the address and paste it in your code (BatchPath) and Add “\”
    copy file name and paste it in your code (BatchPath) after “\” and <FileName>.bat
    now run It.
    Are you saying to just hard code the batch file path in my code to test it? I don't really understand or are you just saying copy and paste the path and then the file name so you're sure its right?

    Comment

    • hariharanmca
      Top Contributor
      • Dec 2006
      • 1977

      #17
      Originally posted by NyNyHelp
      Are you saying to just hard code the batch file path in my code to test it? I don't really understand or are you just saying copy and paste the path and then the file name so you're sure its right?
      yes, don't hard code, for testing purpose just do it

      Comment

      • NyNyHelp
        New Member
        • Jul 2007
        • 21

        #18
        Originally posted by hariharanmca
        yes, don't hard code, for testing purpose just do it

        I have and just did again and it still doesn't work. This I would say baffles me the most because I could understand if I was using an array and grabbing the filenames from the System.IO.Direc tory.GetFiles() command (which I am) and passing them to the Shell that maybe theres like garbage whitespace or something else messing up the path but when I put in for testing Shell("S:\TestF ile\batch1.bat" ) and it still states the file is not found I don't know what it could be.

        Comment

        • NyNyHelp
          New Member
          • Jul 2007
          • 21

          #19
          Well it seems that the folder I was trying to run the batch files from wasn't allowed to execute files. This is weird because our IT Tech gave me specific permissions to execute everywhere but whatever I just moved all my files to a folder where they run all there applications and I was able to execute the files there. I found this out by trying to execute from my local Documents folder (didn't work) but when I moved it to my programs folder it worked like a charm. So I want to thank you guys for your advice and time.

          -John

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #20
            Thanks for giving us the details on how it turned out. Not only was I curious, but this may be helpful for anyone who comes here with a similar problem in the future.

            However, what I don't get is this. How come it did work when you used Explorer or the Start | Run command?

            Comment

            • hariharanmca
              Top Contributor
              • Dec 2006
              • 1977

              #21
              Originally posted by NyNyHelp
              Well it seems that the folder I was trying to run the batch files from wasn't allowed to execute files. This is weird because our IT Tech gave me specific permissions to execute everywhere but whatever I just moved all my files to a folder where they run all there applications and I was able to execute the files there. I found this out by trying to execute from my local Documents folder (didn't work) but when I moved it to my programs folder it worked like a charm. So I want to thank you guys for your advice and time.

              -John
              I think, this may happen. Because,

              1. Wherever you open, some (.EXE and some other) programs create (.tmp) file in primary partition (C :\).
              2. .Bat file will run, if your code does not create any file in the area, which is written protected by Admin.
              3. If it’s able to run in IE or RUN command, then it should be run through .bat file which is triggered by VB code.
              4. If you give, where you copy the program to run and where it wouldn’t run? (we can get proper solution).

              Comment

              • NyNyHelp
                New Member
                • Jul 2007
                • 21

                #22
                I was able to run the files in my program files folder and on a application server. But I could not run them in the my documents folder or shared servers.

                Comment

                • hariharanmca
                  Top Contributor
                  • Dec 2006
                  • 1977

                  #23
                  Originally posted by NyNyHelp
                  I was able to run the files in my program files folder and on a application server. But I could not run them in the my documents folder or shared servers.
                  Then it is secured by windows authentication. User access denied.

                  Comment

                  • Killer42
                    Recognized Expert Expert
                    • Oct 2006
                    • 8429

                    #24
                    Originally posted by NyNyHelp
                    I was able to run the files in my program files folder and on a application server. But I could not run them in the my documents folder or shared servers.
                    Hang on...

                    From what you told us, you could run them from wherever, but your program couldn't. Are you saying this is not the case? That's why I said to take the commad your program was issuing, and paste it into the "Run..." dialogue - to make sure we were talking about the same thing in each case.

                    Comment

                    • Deon
                      New Member
                      • Jun 2007
                      • 1

                      #25
                      Hi

                      I am having the same problem. However I have full access to the directory where the bat file is stored. It also worked a couple of days ago. I have moved the bat file to various locations but no luck. Frustrating....

                      Comment

                      • Killer42
                        Recognized Expert Expert
                        • Oct 2006
                        • 8429

                        #26
                        Originally posted by Deon
                        I am having the same problem. However I have full access to the directory where the bat file is stored. It also worked a couple of days ago. I have moved the bat file to various locations but no luck. Frustrating....
                        Sorry if this sounds ridiculous, but could you please provide us with as much detail as possible about what you are attempting, in what environment, and the precise result? Your idea of what is "the same problem" might be very different to, say, mine. Which may be different again to someone else's. Sometimes, seemingly insignificant details can make all the difference.

                        Comment

                        Working...