Computer Hope

Microsoft => Microsoft DOS => Topic started by: papayrus on November 22, 2009, 07:54:40 PM

Title: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 22, 2009, 07:54:40 PM
Anyone know how to do this?
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: gh0std0g74 on November 22, 2009, 08:52:39 PM
what are you trying to do ?
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 23, 2009, 12:28:40 AM
I don't like the sound of this.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Helpmeh on November 23, 2009, 04:05:25 AM
Doesn't sound "iffy" to me...Although it doesn't matter, as I don't know how either.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 23, 2009, 04:15:33 AM
If a batch file exists in a zip archive, and nowhere else, you cannot run it without first extracting it.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 23, 2009, 01:51:54 PM
Anyone know how to do this?


What I am doing is making a program that installs font to change the font in a game I play. Problem is I made 20 different batch files with 20 reg files to go with it and 20 proxy files to go with it. What I am trying to achieve is packing all those files into a zip file to make the program smaller and to make it more organized while still being able to launch them from a batch file outside the zip archive.  I use a batch file to offer choices of what font to choose then when you choose the number the font corresponds to it launches the proxy file that in return launches the batch file without a dos box and in return the batch file launches the reg file in silent mode.

Each batch file adds this registry entry cause it's needed to make the font show in the game.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"±¼¸²Ã¼"="Ariel"


Thats the code and when I want to change font I use a batch file that will basically change the font name such as Ariel will get changed to Candara in the registry if I hit the number 2 key and enter.
Also another problem I have is that anytime I change the font I have to reboot my computer before it shows in the game does anyone know a way that I can avoid the need to reboot before I can see my font in the game.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 23, 2009, 01:54:22 PM

I know it's only been a day but does anyone know how to run a batch file that is inside a zip archive from a batch file that is not inside a zip archive?

You got the answer above, already. Can you read?
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 23, 2009, 02:07:02 PM
Ahahaha I was in the wrong place I didnt realise so many people responded.
OK so theres no way to to do that. Anyway I can make this more organised and get my font to show in game without having to reboot?
I can send the whole program to you if you can take a look at it and see what I'm trying to accomplish.
Basically it's just a side project for fun since I'm trying to learn coding and actionscript 3 which is a different subject cause I'm having problems with that as well using swf studio ssCore to install the same registry key I cant get it to do anything but thats off the topic of the batch file version.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 23, 2009, 02:26:39 PM
Your project sounds distinctly virus like, modding the registry silently, etc.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 23, 2009, 02:32:47 PM
Um I dont waste my time making viruses. If you read the post I tell you exactly what I'm doing.
Anyway I'll check back tommorrow got to go for now thanks.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 23, 2009, 03:35:26 PM
I don't know if I buy this game story.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 23, 2009, 07:50:12 PM
Hmmmm Here.s the code of the main file.

Not complete yet

@echo off
COLOR 0b

echo _______________________________________ _______________________________________ __
echo 1 = Ariel        3 = Myriad Pro   
echo 2 = Candara      4 = Algerian
echo _______________________________________ _______________________________________ __
echo Please choose a number from the list above that corresponds to the font you want to use for example enter the number 1 if you would like to use Ariel!!
echo _______________________________________ _______________________________________ __
echo If you wish to restore your original system font press the R KEY now then press enter.
echo _______________________________________ _______________________________________ __

set input=
set /p input=Enter Your Option
if %input%==1 goto 1
if %input%==2 goto 2
if %input%==3 goto 3
if %input%==4 goto 4
if %input%==5 goto 5
if %input%==6 goto 6
if %input%==7 goto 7
if %input%==r goto 8




:1
cls
echo _______________________________________ _______________________________________ __
echo Added the registry key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]"±¼¸²Ã¼"="Ariel"
start "" Ariel.bat
goto :0




:2
cls
echo _______________________________________ _______________________________________ __
echo Added the registry key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]"±¼¸²Ã¼"="Cardana"
start "" Candara.exe
goto :0


:3
cls
echo _______________________________________ _______________________________________ __
echo Added the registry key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]"±¼¸²Ã¼"="Myriad Pro"
start "" MyriadPro.bat
goto :0


:4
cls
echo _______________________________________ _______________________________________ __
echo Added the registry key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]"±¼¸²Ã¼"="Algerian"
start "" Algerian.bat
goto :0








:8
cls
echo _______________________________________ _______________________________________ __
echo Deleted the registry key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]"±¼¸²Ã¼"="Your Font"
start "" RestoreFont.bat
goto :100




:0
echo _______________________________________ _______________________________________ __
echo You must restart your computer for the font to work in RF Online.
echo _______________________________________ _______________________________________ __
echo Y = Yep restart so I can enjoy my new font.

echo N = Nope I'll restart later cause I'm downloading porn.
echo _______________________________________ _______________________________________ __

set input=
set /p input=Enter your Option
if %input%==y goto y
if %input%==n goto n

:y
shutdown -r -t 00 -c "DELETING YOUR *censored* PLEASE BE PATIENT"

:n
exit





:100
echo _______________________________________ _______________________________________ __
echo Your font has been restored. You must restart your computer for the changes to take effect.
echo _______________________________________ _______________________________________ __
echo Y = Yep restart so my font is restored.

echo N = Nope I'll restart later cause I'm downloading porn.
echo _______________________________________ _______________________________________ __

set input=
set /p input=Enter your Option
if %input%==y goto y
if %input%==n goto n

:y
shutdown -r -t 00

:n
exit



And heres the code of the batch file for the fonts

regedit.exe /s Ariel.reg
exit



And heres the reg file code

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"±¼¸²Ã¼"="Ariel"


Basically thats what I'm trying to accomplish and running in silent mode just makes it more professional quality. It's a simple registy change that makes the font change in the game I am playing on my own computer. The weird looking ±¼¸²Ã¼ comes from the games own font.ini file thats the name in the file.

[FONT]
NAME = "±¼¸²Ã¼"

If you dont understand that then please just let it go for someone else who might understand it.
















Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Helpmeh on November 23, 2009, 08:00:40 PM
Quote
shutdown -r -t 00 -c "DELETING YOUR *censored* PLEASE BE PATIENT"
this worries me.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: BC_Programmer on November 23, 2009, 09:24:45 PM
I love all this, hey, the font name is in the INI file, but instead of simply you know, doing the obvious thing and changing the INI file, let's define a new font substitute!

This is the POINT of INI Files. Why not change the INI file, or is this entire solution derived simply to make it possible to change the font EASILY via the registry? It IS possible to change a INI file via Batch.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 24, 2009, 12:17:51 AM
Quote
Posted by: Helpmeh      Posted on: Today at 03:00:40 AM
Insert Quote
Quote
shutdown -r -t 00 -c "DELETING YOUR *censored* PLEASE BE PATIENT"
this worries me.

THis whole thing stinks of prank or worse, like I said before.

And the cheeky little sod dares to patronize his betters:

Quote
If you dont understand that then please just let it go for someone else who might understand it.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Quantos on November 24, 2009, 05:03:23 AM
And the cheeky little sod dares to patronize his betters
Not a good way to endear himself and receive help...
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 24, 2009, 05:21:30 AM
Still 20 19 posts to go...

Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 05:50:43 AM
First of all your wrong and if you dont understand shutdown -r -t 00 -c "DELETING YOUR *censored* PLEASE BE PATIENT" then get lost I'm tired of listening to you. You sound like a old hag.
This is the restart command and in the main code you can see if you do even understand any code that it offers the option to reboot the computer cause um thats needed in order to make the font work in the game. And if you can see shutdown -r -t 00 -c "DELETING YOUR *censored* PLEASE BE PATIENT" after they choose the option to reboot it has 00 for timer which just reboots the computer I put -c "DELETING YOUR *censored* PLEASE BE PATIENT" in it cause I can change the timer say give like a 15 second timer before it restarts and it will display that funny message to my friends who will be using it. It's called humor get a sense og it cause I really think you are more confused than I am. Basically your not helping and I dont think you understand whats actually going on you dont even seem to be able to understand the program at all so please stop nagging.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: BC_Programmer on November 24, 2009, 06:00:39 AM
there is no need to reboot the PC to get the font working.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Quantos on November 24, 2009, 06:01:01 AM
First of all your wrong and if you dont understand shutdown -r -t 00 -c "DELETING YOUR *censored* PLEASE BE PATIENT" then get lost I'm tired of listening to you. You sound like a old hag.

I'm pretty sure that you've just alienated yourself from the people that do know, and may have helped you had you apologized for your attitude.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 24, 2009, 06:01:37 AM
Abusive language reported
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 24, 2009, 06:04:54 AM
Quote
It's called humor

It's called juvenile stupidity
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 10:30:15 AM
Not a good way to endear himself and receive help...
Salmon Trout said that lame statement along with all his other post wrecking statements.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 10:34:00 AM
You know what f it. I came here for help and I get Salmon Trout the retard. Anyway I'll go elsewhere there's no need for me to stupe down to the slug level of Salmon Pout. Bye loser have fun in your important busy life of trashing posts. What an accomplishment you are. Your mom must be so proud. LOL you put yourself as an adviser but you need lots of advice cause your not much of an adviser.
Here, I will advise you Salmon Crotch. Go get some kind of special pill or mental help cause you dont know how to communicate properly. You will not have many friends in real life and you probably dont if you greet people in the manner you have greeted me. Calling a simple program malicious when anyone that can read a simple code can see that it is not. Accusing new comers of this and that and saying stupid ignorant things that I hear grade schoolers say to each other to make themselves feel better about themselves. You dont empower yourself by acting that way you embarrass yourself and no girl that is worth anything will ever want anything to do with a person like you.  You will always be a loser if you grow up or get help to grow up. I really feel bad for you if your actual age is above 12. Goodluck with getting the proper advise you need adviser LOL LMAO adviser ahahaha.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 24, 2009, 10:46:27 AM
Oh dear!  :-[ His own fantasies I think...
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 10:59:32 AM
LOL this really is all that you do isnt it. Linger like a leech in a forum all your life and attack anyone you feel like to make your small self feel better about your self. LOL LLLLOOOOLLLLLL get a life loser. You just said another 12 year old statement. Must be your fantasies ahahaha thats what a 12 year old would pout back at someone. LOL oh well not my fault I can simply laugh at people like you and shrug it off and know atleast something gave me laugh for the day.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 24, 2009, 11:18:36 AM
Quote
I'll go elsewhere

Please do. What are you waiting for?
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 11:25:44 AM
Please do. What are you waiting for?

I reported you Salmon Crotch. I dont care what happens but you should learn to mind your own business especially considering you have nothing of value to offer.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 11:29:07 AM
I'm pretty sure that you've just alienated yourself from the people that do know, and may have helped you had you apologized for your attitude.

Dude that was directed at Salmon Crotch and if you are on his side your probably his good buddy. I dont need help from people like that obviously they cant read dos code. I need help from people that have minds.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 11:39:08 AM
there is no need to reboot the PC to get the font working.

Hey man just wanted to thank you. I think you actually understand what I am doing just a simple fun little program to change my font in the game. But unfortunatly yes I do have to reboot for the font to show in the game. Not a big deal though mostly I was just trying to get help organising my program better thats why I even posted all the code to it. If you can help then please do. I reported salmon trout because he is just a nuissance to a good intention. Hope we can continue to move on despite Salmon Trouts posts. This is my first time here and thanks to Salmon Trout it wasnt a pleasant first time but I can deal with people like that. Anyway
Thanks Again
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Quantos on November 24, 2009, 12:48:07 PM
Papayrus, you won't be getting any additional help from anyone.
Your juvenile and abusive attitude has been observed, measured, and found lacking.

We are volunteers here, supporting people who need it.  If you think you can come in here and abuse us of your own free will, then you have another thing coming.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 12:56:34 PM
I said I dont want your help. People like you are sick please don talk to me as I said I am looking for decent people unlike you thanks. Good Day Mate
Nobody asked YOU I am asking someone that can actually help you are not helpful in anyway and you make no sense get off my post and dont talk to me cause you have nothing good to offer.
I came here in a good mood with good intentions and you and Slamon Fish should not even be allowed in a public internet access place you just wreck it for everyone and I dont take crap from people like you. Get real or just go away.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout on November 24, 2009, 01:08:34 PM
Quote
get off my post

Someone's heading for a ban...
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 01:10:46 PM
Drink some more wine dude.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 02:00:15 PM
Someone's heading for a ban...
[/quoteYou should be banned from the public.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Helpmeh on November 24, 2009, 02:23:46 PM
Sometimes I wish EVERYONE would get banned.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 04:08:24 PM
May as well delete this it just got trashed by a couple rude people anyway. Actually I think salmon is 2 people 2 accounts lol.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: BatchFileBasics on November 24, 2009, 04:20:32 PM
why don't you start by learning how to extract contents from a zip using batch?

http://www.computerhope.com/forum/index.php?topic=66630.0
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 04:22:28 PM
Thankyou for that link I will check it out.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 04:30:01 PM
Thankyou for that link I will check it out.
I checked it out I am confused about the code is this a batch file?

Set WshShell = CreateObject("Wscript.Shell")
user = WshShell.ExpandEnvironmentStrings("%UserName%")

strZipFile = "c:\documents and settings\" & user & "\fr5\resource.zip"
outFolder = "c:\documents and settings\" & user & "\fr5\"
   
Set objShell = CreateObject( "Shell.Application" )
Set objSource = objShell.NameSpace(strZipFile).Items()
Set objTarget = objShell.NameSpace(outFolder)
intOptions = 256
objTarget.CopyHere objSource, intOptions

where it says %username% do I just type it as is or do I need to type in a username of some sort?
also what is strZipFile?
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: BatchFileBasics on November 24, 2009, 05:01:53 PM
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
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 08:08:39 PM
Thats pretty nice but but how can I use this to run a batch file that is inside of a zip archive?
Ok the vbs works great. Is there a way to use it to actually launch the batch file that is inside the zip file OR do I need to extract the batch file then run it then delete it to do it?
Also how do I make the directory not need a full path for example I want it to extract the file in the zip archive in the same folder ther vbs is in? I tried strZipFile = "111.zip" and for the next part outFolder = "" with no name but it gets an error I then put in the full path and the error went away but I just want to have it work inside the directory its located in so it can be portable.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: gh0std0g74 on November 24, 2009, 08:20:07 PM
you got to unzip your archive, then run the batch. which part of this you did not get?
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 24, 2009, 08:42:57 PM
you got to unzip your archive, then run the batch. which part of this you did not get?

Ok the vbs works great. Is there a way to use it to actually launch the batch file that is inside the zip file OR do I need to extract the batch file then run it then delete it to do it?
Also how do I make the directory not need a full path for example I want it to extract the file in the zip archive in the same folder ther vbs is in? I tried strZipFile = "111.zip" and for the next part outFolder = "" with no name but it gets an error I then put in the full path and the error went away but I just want to have it work inside the directory its located in so it can be portable.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: gh0std0g74 on November 24, 2009, 09:30:54 PM
OR do I need to extract the batch file then run it then delete it to do it?
that's what i said.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus 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?
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: gh0std0g74 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?

Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: mroilfield 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?
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus 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.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Salmon Trout 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.



Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus 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
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Sidewinder 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)
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus 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?
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Sidewinder 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.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus 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!
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus 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.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Sidewinder 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 (http://www.microsoft.com/downloads/details.aspx?familyid=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en). It is the the documentation which has examples of just about every method and property available in VBScript.

Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus 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.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus 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 (http://www.microsoft.com/downloads/details.aspx?familyid=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en). 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

Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Sidewinder 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.
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 25, 2009, 04:41:53 PM
Here is the path of the working folder.
C:\Documents and Settings\Administrator\Desktop\VBS FONT EXTRACT

The folder I want to delete is called fonts and it is at this path.
C:\Documents and Settings\Administrator\Desktop\VBS FONT EXTRACT\fonts


Just to clarify I used the code for deleting in a new vbs script I didnt put it with the main one yet its all alone in one vbs file. Is that wrong?
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: Sidewinder on November 25, 2009, 04:51:08 PM
I thought you were adding the snippet to your existing script. The WshShell needs to be created in a new script:

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

 8)
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 25, 2009, 04:55:27 PM
That did it. I'm gonna take a break hope you dont mind if I ask a few more questions later. I will try to get this figured out but I may still need some help maybe tommorrow. Thanks again man I appreciate it.:)

I had to make it like this though just to clarify inorder for it to work and delete the fonts folder.

Set WshShell = CreateObject("Wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set fl = fso.GetFolder(WshShell.CurrentDirectory & "\fonts")
fl.Delete(True)
Title: Re: How to run a batch file inside a zip archive from a batch file?
Post by: papayrus on November 29, 2009, 06:05:10 AM
Just wanted to say thank you once again to sidewinder. Because of you I learned and I am now working with VBS scripts and it is great. People like sidewinder are a great contribution to any society weather it be alien or human. 100% excellent. I am smarter because of sidewinder.
Thank You very much.