Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to run a batch file inside a zip archive from a batch file?  (Read 31541 times)

0 Members and 1 Guest are viewing this topic.

papayrus

    Topic Starter


    Rookie

    Re: How to run a batch file inside a zip archive from a batch file?
    « Reply #45 on: November 24, 2009, 10:12:54 PM »
    that's what i said.
    No offense guy but your not reading all the question. Try to be kind and cool if you can your not above me. Whats up with people on this site?

    gh0std0g74



      Apprentice

      Thanked: 37
      Re: How to run a batch file inside a zip archive from a batch file?
      « Reply #46 on: November 24, 2009, 10:31:58 PM »
      i am only answering this part of the question you posed
      Quote from: papayrus
      ..... OR do I need to extract the batch file then run it then delete it to do it?

      which i already did say :
      Quote from: gh0std0g74
      you got to unzip your archive, then run the batch. which part of this you did not get?

      use the same tool you use to zip your files, to unzip it , run the batch, and then delete it if you want. any problem understanding this?


      mroilfield



        Mentor
      • Thanked: 42
        • Yes
        • Yes
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows 11
      Re: How to run a batch file inside a zip archive from a batch file?
      « Reply #47 on: November 24, 2009, 10:37:42 PM »
      Try to be kind and cool if you can your not above me. Whats up with people on this site?

      You are definitely not above any one here either so drop the attitude. If you don't like what some one says just ignore it.

      Like previously mentioned the people here volunteer their time so being nice will get you better help as no one gets paid to do any of this. There are some people here that could really help you with this if you would just work with them.

      What game is that you want to change the font on?
      You can't fix Stupid!!!

      papayrus

        Topic Starter


        Rookie

        Re: How to run a batch file inside a zip archive from a batch file?
        « Reply #48 on: November 24, 2009, 10:45:25 PM »
        You are definitely not above any one here either so drop the attitude. If you don't like what some one says just ignore it.

        Like previously mentioned the people here volunteer their time so being nice will get you better help as no one gets paid to do any of this. There are some people here that could really help you with this if you would just work with them.

        What game is that you want to change the font on?

        It's called RF Online Guy look at my first posts when I started this post. I was being very nice then I was attacked by a jerk for no reason. So I am trying to be nice, and good for you for volunteering you must enjoy doing it or you would not volunteer so being a volunteer means you can treat people like they are lesser than you? Start from the beginning I have all the code there and you can see my intentions when I began were just fine and I am nice tell Salmon Fish and the other people who cant volunteer and have a good attitude doing it. I came in perfectly positive. I'm trying to keep positive here I sure dont need lessons in life I am asking for help with code not lessons in life if you want to start a new post and call it lessons in life then go ahead but can we stick to the topic here and try to be cool at the same time? And guy I never said I was above anyone I wasnt the one who started the whole making this post trash talk to salmon fish hes the one who started trashing the post. I read his other posts and he's got a smart allek attitude everywhere. So put yourself in my shoes guy. I came here all like oh cool ill ask for help for this fun project I am doing and first thing I am hit with is a jerk and he would not lay off. He's a bad example to this site and I am pretty sure he can not code cause he could not even understand my basic dos code.Your statement "You are definitely not above any one here" shows you have an attitude when I was trying to make peace.
        So please nobody help that is not willing to focus on the subject and the subject alone this is a coding post not a self help seminar. Regards to the real coders that just want to help ignores to the next person that goes off the topic.
        « Last Edit: November 24, 2009, 11:05:02 PM by papayrus »

        Salmon Trout

        • Guest
        Re: How to run a batch file inside a zip archive from a batch file?
        « Reply #49 on: November 25, 2009, 12:14:53 AM »
        papayrus, you started off with the attitude. "If you don't understand..." That was downright rude. Then you kept up the attitude and posted some obscene language. I have been here a lot longer than you. I'll be here here when you are long gone. I'll make one thing quite clear, dumb boy.

        I don't like you.

        Watch yourself around me.

        Watch your mouth.




        papayrus

          Topic Starter


          Rookie

          Re: How to run a batch file inside a zip archive from a batch file?
          « Reply #50 on: November 25, 2009, 01:23:30 AM »
          no, this is vbscript
          Code: [Select]
              strZipFile = ""                                       'name of zip file
              outFolder = ""                                       'destination folder of unzipped files
             
              Set objShell = CreateObject( "Shell.Application" )
              Set objSource = objShell.NameSpace(strZipFile).Items()
              Set objTarget = objShell.NameSpace(outFolder)
              intOptions = 256
              objTarget.CopyHere objSource, intOptions

          save  it as extract.vbs

          then in your batch file put this line
          Code: [Select]
          cscript //nologo extract.vbs

          How to make the directory to be the current directory instead of using the full path name? I tried this strZipFile = "111.zip" but I get an error

          Sidewinder



            Guru

            Thanked: 139
          • Experience: Familiar
          • OS: Windows 10
          Re: How to run a batch file inside a zip archive from a batch file?
          « Reply #51 on: November 25, 2009, 06:48:36 AM »
          Good grief! 50 posts to unzip a single file. Must be a new record. ;D

          Quote
          How to make the directory to be the current directory instead of using the full path name? I tried this strZipFile = "111.zip" but I get an error

          Code: [Select]
              Set WshShell = CreateObject("Wscript.Shell")
              strZipFile = WshShell.CurrentDirectory & "\111.zip"  'name of zip file
              outFolder = ""                                       'destination folder of unzipped files
             
              Set objShell = CreateObject( "Shell.Application" )
              Set objSource = objShell.NameSpace(strZipFile).Items()
              Set objTarget = objShell.NameSpace(outFolder)
              intOptions = 256
              objTarget.CopyHere objSource, intOptions

          Be aware that the CopyHere method runs asynchronously with the rest of the script. If you plan on adding code after the last line currently in the script, you will need to insert a WScript.Sleep command to delay executing the next instruction.

           8)
          The true sign of intelligence is not knowledge but imagination.

          -- Albert Einstein

          papayrus

            Topic Starter


            Rookie

            Re: How to run a batch file inside a zip archive from a batch file?
            « Reply #52 on: November 25, 2009, 09:13:59 AM »
            Thats awesome. Actually I wasnt even planning on using VBS I was wanting to do it from just a batch file but I take it thats not possible without a third party program And to say the least this is great cause I plan to learn C++ and VBS just didnt plan on learning it now but too late I can feel the addiction coming hihi.
            I forgot to add that I also wanted to extract the 111.zip to the current directory as well can you tell me how to do that?
            As for adding more code to it before as I said I wasnt thinking about that but now I would like to maybe do the whole program in VBS if thats possible instead of using batch files. Actually now I want to learn VBS now ASAP seems much more powerful than batch. I am using codeblocks for practicing C++ but I was wondering how would I go about changing this VBS into and exe. I tried to compile in codeblocks but got errors.

            I did this and it works.
            Set WshShell = CreateObject("Wscript.Shell")
                strZipFile = WshShell.CurrentDirectory & "\111.zip" 
                outFolder = WshShell.CurrentDirectory &"\"                 
               
                Set objShell = CreateObject( "Shell.Application" )
                Set objSource = objShell.NameSpace(strZipFile).Items()
                Set objTarget = objShell.NameSpace(outFolder)
                intOptions = 256
                objTarget.CopyHere objSource, intOptions

            Is this proper?
            « Last Edit: November 25, 2009, 11:02:27 AM by papayrus »

            Sidewinder



              Guru

              Thanked: 139
            • Experience: Familiar
            • OS: Windows 10
            Re: How to run a batch file inside a zip archive from a batch file?
            « Reply #53 on: November 25, 2009, 11:15:56 AM »
            Admittedly I did not read the entire thread. After the topic did a header into the swamp I forgot the original question, so I took most of the specs from the first page.

            This is by no means complete. I wrote all the sections you need but you need to complete them. There may be some problems with the path information on the batch files, but I'm sure you'll point them out.  ;D

            Code: [Select]
                Set WshShell = CreateObject("Wscript.Shell")
                strZipFile = WshShell.CurrentDirectory & "\111.zip" 'name of zip file
                outFolder = WshShell.CurrentDirectory                'destination folder of unzipped files
               
                Set objShell = CreateObject( "Shell.Application" )
                Set objSource = objShell.NameSpace(strZipFile).Items()
                Set objTarget = objShell.NameSpace(outFolder)
                intOptions = 256
                objTarget.CopyHere objSource, intOptions
                WScript.Sleep 45000 'arbitrary 45 seconds; adjust as necessary
               
                WScript.Echo "Choose the font:" 'add fonts as necessary
                WScript.Echo " 1 = Ariel"
                WScript.Echo " 2 = Candara"
                WScript.Echo " 3 = Myriad Pro"
                WScript.Echo " 4 = Algerian"
                WScript.Echo ""
                WScript.Echo "Enter Option Number:"
               
                Do While Not WScript.StdIn.AtEndOfLine
                Input = WScript.StdIn.Read(2)
                Loop


                Select Case Input 'should be one case statement for each font
            Case 1 : WshShell.Run WshShell.CurrentDirectory & "\ariel.bat",,True
            Case 2 : WshShell.Run WshShell.CurrentDirectory & "\candara.bat",,True
            Case 3 : WshShell.Run WshShell.CurrentDirectory & """\Myriad Pro.bat""",,True
            Case 4 : WshShell.Run WshShell.CurrentDirectory & "\Algerian.bat",,True
            Case Else WScript.Echo "Invalid Choice...Job Terminated" : WScript.Quit
                End Select
                WScript.Echo "Registry has been successfully hacked"

            Note: This must be run with CScript.
            The true sign of intelligence is not knowledge but imagination.

            -- Albert Einstein

            papayrus

              Topic Starter


              Rookie

              Re: How to run a batch file inside a zip archive from a batch file?
              « Reply #54 on: November 25, 2009, 11:21:08 AM »
              OMG dude I cant believe you did all that. I am going to try it out now. Thank you so much I been sitting here playing around with the first VBS script you gave me and I'm totally enjoying it. So far I made it so it unzips the archive in a folder in the same directory then when you exit it deletes that directory so it cleans itself up lol. Im gonna try this new one give me a few hours cause I'm gonna learn alot from it I can tell already. Thank you so much!

              papayrus

                Topic Starter


                Rookie

                Re: How to run a batch file inside a zip archive from a batch file?
                « Reply #55 on: November 25, 2009, 02:41:38 PM »
                Admittedly I did not read the entire thread. After the topic did a header into the swamp I forgot the original question, so I took most of the specs from the first page.

                This is by no means complete. I wrote all the sections you need but you need to complete them. There may be some problems with the path information on the batch files, but I'm sure you'll point them out.  ;D

                Code: [Select]
                    Set WshShell = CreateObject("Wscript.Shell")
                    strZipFile = WshShell.CurrentDirectory & "\111.zip" 'name of zip file
                    outFolder = WshShell.CurrentDirectory                'destination folder of unzipped files
                   
                    Set objShell = CreateObject( "Shell.Application" )
                    Set objSource = objShell.NameSpace(strZipFile).Items()
                    Set objTarget = objShell.NameSpace(outFolder)
                    intOptions = 256
                    objTarget.CopyHere objSource, intOptions
                    WScript.Sleep 45000 'arbitrary 45 seconds; adjust as necessary
                   
                    WScript.Echo "Choose the font:" 'add fonts as necessary
                    WScript.Echo " 1 = Ariel"
                    WScript.Echo " 2 = Candara"
                    WScript.Echo " 3 = Myriad Pro"
                    WScript.Echo " 4 = Algerian"
                    WScript.Echo ""
                    WScript.Echo "Enter Option Number:"
                   
                    Do While Not WScript.StdIn.AtEndOfLine
                    Input = WScript.StdIn.Read(2)
                    Loop


                    Select Case Input 'should be one case statement for each font
                Case 1 : WshShell.Run WshShell.CurrentDirectory & "\ariel.bat",,True
                Case 2 : WshShell.Run WshShell.CurrentDirectory & "\candara.bat",,True
                Case 3 : WshShell.Run WshShell.CurrentDirectory & """\Myriad Pro.bat""",,True
                Case 4 : WshShell.Run WshShell.CurrentDirectory & "\Algerian.bat",,True
                Case Else WScript.Echo "Invalid Choice...Job Terminated" : WScript.Quit
                    End Select
                    WScript.Echo "Registry has been successfully hacked"

                Note: This must be run with CScript.



                I'm working on it but I need your help again with working in the current directory. I can't seem to figure out how to delete a folder in the current directory without having to add the complete path. EXAMPLE

                Dim FSO, Folder
                set FSO=CreateObject("Scripting.FileSystemObject")
                Folder= "C:\Documents and Settings\Administrator\Desktop\VBS FONT EXTRACT\fonts"

                wscript.echo "Cleaning Temp Files"
                FSO.DeleteFolder(Folder)
                wscript.echo Folder,"now deleted"

                I made that to delete the folder the fonts extracted to but I dont want to use a path like that cause that defeats the purpous of making it portable. Is there anyway to delete a folder from the current directory? I really looked all over google and all I found were methods that involved using paths and not current directory.

                Sidewinder



                  Guru

                  Thanked: 139
                • Experience: Familiar
                • OS: Windows 10
                Re: How to run a batch file inside a zip archive from a batch file?
                « Reply #56 on: November 25, 2009, 04:05:30 PM »
                There are a couple of ways to do this, either by directly acting on the folder object or using the FileSystemObject. Need more info: What part of C:\Documents and Settings\Administrator\Desktop\VBS FONT EXTRACT\fonts is the current directory?

                For example, if  C:\Documents and Settings\Administrator\Desktop is the current directory, this little snippet will help to show method:

                Code: [Select]
                Set fso = CreateObject("Scripting.FileSystemObject")
                Set fl = fso.GetFolder(WshShell.CurrentDirectory & "\VBS FONT EXTRACT\fonts")
                fl.Delete(True)

                Note: Don't use obvious datanames like folder or file. Debugging becomes a nightmare because VBScript uses such names for it's methods and properties.

                Try searching your disk for the script56.chm file. If not found, you can download it from here. It is the the documentation which has examples of just about every method and property available in VBScript.

                The true sign of intelligence is not knowledge but imagination.

                -- Albert Einstein

                papayrus

                  Topic Starter


                  Rookie

                  Re: How to run a batch file inside a zip archive from a batch file?
                  « Reply #57 on: November 25, 2009, 04:20:21 PM »
                  VBS FONT EXTRACT thats the working folder and fonts is the folder I want to delete. I saw the cscript you were saying to run in cscript so I figured it out but I get an error. I dont get an error till later just double clicking on it I guess thats using wscript but it doesnt let me make my choices that way just get the dialog boxes which is cool cause I learned how to make the echo boxes hihi. I have a few more questions but want to get the folder delete thing resolved first I'm taking baby steps.

                  papayrus

                    Topic Starter


                    Rookie

                    Re: How to run a batch file inside a zip archive from a batch file?
                    « Reply #58 on: November 25, 2009, 04:36:31 PM »
                    There are a couple of ways to do this, either by directly acting on the folder object or using the FileSystemObject. Need more info: What part of C:\Documents and Settings\Administrator\Desktop\VBS FONT EXTRACT\fonts is the current directory?

                    For example, if  C:\Documents and Settings\Administrator\Desktop is the current directory, this little snippet will help to show method:

                    Code: [Select]
                    Set fso = CreateObject("Scripting.FileSystemObject")
                    Set fl = fso.GetFolder(WshShell.CurrentDirectory & "\VBS FONT EXTRACT\fonts")
                    fl.Delete(True)

                    Note: Don't use obvious datanames like folder or file. Debugging becomes a nightmare because VBScript uses such names for it's methods and properties.

                    Try searching your disk for the script56.chm file. If not found, you can download it from here. It is the the documentation which has examples of just about every method and property available in VBScript.



                    got the chm file thanks for that. When I ran the delete folder vbs script I got an error here's my code


                    Set fso = CreateObject("Scripting.FileSystemObject")
                    Set fl = fso.GetFolder(WshShell.CurrentDirectory &"\fonts")
                    fl.Delete(True)

                    Is that right for deleting the fonts folder in the same directory I am running this VBS file?
                    The error is
                    Line: 2
                    Char: 1
                    Error: Object required: "WshShell"
                    Code 800A01A8
                    Source: Microsoft VBScript runtime error


                    Sidewinder



                      Guru

                      Thanked: 139
                    • Experience: Familiar
                    • OS: Windows 10
                    Re: How to run a batch file inside a zip archive from a batch file?
                    « Reply #59 on: November 25, 2009, 04:38:59 PM »
                    Quote
                    VBS FONT EXTRACT thats the working folder and fonts is the folder I want to delete.

                    That should have worked. I'm confused. What do you mean by working folder? Please post the name of the current directory.

                    WScript and CScript are for the most part interchangeable. One runs in Windows with no console, the other runs at the console. The WScript.Echo instruction, as you found out produces output in Windows. The same instruction in CScript produces console output. If you have a lot of echoed output, CScript is the way to go. More importantly, WScript cannot be used with the STDIN, STDOUT, OR STDERR properties. The STDIN property is present in your script which is why I mentioned using CScript.

                     8)

                    PS. WScript is generally the default script engine unless it is overridden.
                    The true sign of intelligence is not knowledge but imagination.

                    -- Albert Einstein