Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Run multiple dos command in one session. URGENT!!!

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,36563
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Run multiple dos command in one session. URGENT!!!
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Run multiple dos command in one session. URGENT!!! - 7/27/2006 3:46:04 PM   
  buffalokml

 

Posts: 15
Score: 0
Joined: 4/3/2006
Status: offline
I want to change directory and generate zip file within same session like scirpt below but it is not working. Because there is a bug with wzzip command, I must be in the folder that I want to zip to get exclude list working. I did verify in the DOS Prompt. Is there anyway that I could work around this issue?

Set objShell = CreateObject("WScript.Shell")
objShell.Run "cmd /c cd \temp", 0, true
objShell.Run "wzzip -arp [email=-x@exclude.txt]-x@exclude.txt[/email] temp.zip *", 0 , true

 
 
Post #: 1
 
 RE: Run multiple dos command in one session. URGENT!!! - 7/27/2006 11:50:37 PM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Dos has a cool character' &' that can be used to run multiple commands in a single command line 'command'.  It can be used thus:

      
That would give you a dir list of c: and d: and you onyl have to hit enter once.

Take your code and apply this:

      


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to buffalokml)
 
 
Post #: 2
 
 RE: Run multiple dos command in one session. URGENT!!! - 7/28/2006 12:24:25 AM   
  mbouchard


Posts: 1924
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Why not just change the directory in your script before calling your app? 


      

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 3
 
 RE: Run multiple dos command in one session. URGENT!!! - 7/28/2006 3:46:28 AM   
  buffalokml

 

Posts: 15
Score: 0
Joined: 4/3/2006
Status: offline
thanks so much for your quick response

I still have problem....here is my code. Could you please tell me what I'm missing here???????


Sub
ReadSolutionFile(strFile)

Dim
strCurrentDir, strDeployDir

Dim
strCreateZipCmd

Dim
objShell

Set
objShell = CreateObject("WScript.Shell")

Set
objFSo = CreateObject("Scripting.FileSystemObject")

set
oFSO = objFSo.GetFile(strFile)

set
oStreamFile = oFSO.OpenAsTextStream(1,-2)
myDate = split(
Date, "/", -1, 1)
myTime = split(Time,
":", -1, 1)
strHrs = split(myTime(2),
" ", -1 , 1)
strDateTime = myDate(0) &
"-" & myDate(1) & "-" & myDate(2) & "_" & myTime(0) & "-" & myTime(1) & "-" & strHrs(0) & "-" & strHrs(1)
strDeployDir = strReleaseVer &
"-" & strDateTime
ExeCmd(
"md " & strDeployDir )

'Loop thru text file line by line

Do
until oStreamFile.AtEndOfStream

dim
strReadLine, strCD
strReadLine = Split(oStreamFile.ReadLine,
"|", -1, 1)
if strReadLine(2) = "NO CONF" then

strZipFileName = strWorkingDir &
"\" & strDeployDir & " " & strReadLine(0) & "-" & strReleaseVer & "-" & CONF & "-" & strDateTime & ".zip" & " " & strWorkingDir & "\" & strReadLine(1) & "\*"

WScript.Echo objShell.CurrentDirectory
WScript.Echo chr(34) & strWorkingDir &
"\" & strReadLine(1) & chr(34)
objShell.CurrentDirectory = chr(34) & strWorkingDir &
"\" & strReadLine(1) & chr(34)
WScript.Echo objShell.CurrentDirectory
CreateZip strZipFileName
else

strZipFileName = strWorkingDir &
"\" & strDeployDir & " " & strReadLine(0) & "-" & strReleaseVer & "-" & CONF & "-" & strDateTime & ".zip" & " " & strWorkingDir & "\" & strReadLine(1) & "\" & CONF & "\*"

WScript.Echo objShell.CurrentDirectory
objShell.CurrentDirectory = chr(34) & strWorkingDir &
"\" & strReadLine(1) & CONF & chr(34)
WScript.Echo objShell.CurrentDirectory
CreateZip strZipFileName
end if

objShell.CurrentDirectory = strWorkingDir

Loop

oStreamFile.Close

End
Sub
 
================
If I run this code I got error:
C:\Projects>CScript GenerateZip.vbs d a 6.8.0.007
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.



Running command:  md 6.8.0.007-7-28-2006_9-35-33-AM
************* Finished *****************
C:\Projects
"C:\Projects\External Libraries\Infragistics61\aspnet_client"
C:\Projects\GenerateZip.vbs(97, 9) (null): The filename, directory name, or volume label syntax is incorrect.
==================

However, If I run with this code, it is working OK
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo WshShell.CurrentDirectory
WshShell.CurrentDirectory = "C:\Projects\External Libraries\Infragistics61\aspnet_client"
WScript.Echo WshShell.CurrentDirectory

C:\vbscript>CScript ChangeDir.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
C:\vbscript
C:\Projects\External Libraries\Infragistics61\aspnet_client

***************************************************
 
 

(in reply to mbouchard)
 
 
Post #: 4
 
 RE: Run multiple dos command in one session. URGENT!!! - 7/28/2006 9:16:44 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
The error you showed says there is a problem with line 97.

Correct that error, and you'll be ok.

Sorry for the generality, but unless you post all of your code, I can't do much more.

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to buffalokml)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Run multiple dos command in one session. URGENT!!! Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts