har-vas Posted March 4, 2006 Share Posted March 4, 2006 Hi all. I have a batch file which runs from GuiRunOnce during the first logon. This script is long and makes many things (installations, copy, delete etc), so I want to redirect to a log file any error messages (eg from a failed copy or delete command), because I need the output for troubleshooting purposes. Now I am trying to note down any errors I see, but I haven't the time needed (as the script is being executed quickly) and I don't want to add any pause or sleep commands in it. I read a lot in the net about redirection (stderr stream) but strangely nothing works for me! Whatever I type in the run box (eg C:\a_script_with_errors.cmd 2>Errors.log), either ALL the output will go to the screen or to the log file. What I want is to be able to see my echo messages (and other commands, eg "1 file copied") on the screen and only any erros to be logged. Is this possible under Windows XP? Which is the correct syntax I should use under GuiRunOnce section in Winnt.sif? Now I have written "%systemdrive%\Installations.cmd 2>> C:\Error.log" (without quotes) but I think that it won't work. Of course, the ideal would be to have all the output (with errors) both on my screen and in a log file, but I think that this is impossible with common dos commands. But maybe a specific utility can make it...Irrelevant: Is it possible to disable the press F6 and F2 messages from my unattended CD? I have all the necessary drivers and I would like to reduce the text mode portion by 10 seconds. Thank you. Link to comment Share on other sites More sharing options...
jbm Posted March 4, 2006 Share Posted March 4, 2006 I believe "mybat.cmd 2>errors.txt" is what you want. Link to comment Share on other sites More sharing options...
gunsmokingman Posted March 4, 2006 Share Posted March 4, 2006 Have you thought about using a VBS script that checks things and makes the reports.Example This Checks For C:\Test.txt then copies it top D:\Test.txt This script reports if it was successful or not successfull.Const OverwriteExisting = TRUE Dim Fso,Act,Report_Log,Ts Set Fso = CreateObject("Scripting.FileSystemObject") Set Act = CreateObject("Wscript.Shell") Report_Log = Act.ExpandEnvironmentStrings("%Systemdrive%\Report_UaInstall.log") '''' OPEN THE REPORT_UAINSTALL.LOG Set Ts = Fso.CreateTextFile(Report_Log) Ts.WriteLine Now() & Space(5) & Act.ExpandEnvironmentStrings("%Username%") & vbCrLf & "Preparing To Copy C:\Test.txt To D:\" If Fso.FileExists("C:\Test.txt") Then Fso.CopyFile "C:\Test.txt" , "D:\" , OverwriteExisting Ts.WriteLine "Confirm Copy Completed" Else Ts.WriteLine "Copy File Error" & vbTab & "C:\Test.txt" & vbTab & "Was Not Found" End If Ts.CloseIf you want help with the vbs script post the cmd script and I will try and do it so they both work together. Link to comment Share on other sites More sharing options...
har-vas Posted March 5, 2006 Author Share Posted March 5, 2006 Hi again. Thanks for your answers. The "mybat.cmd 2>errors.txt" doesn't work, at least from the Run command box. So I think that it will not work during the first logon. What it does is to create the errors.txt file which is empty though and display on the screen both the output (in my case an echo message) and the error (in my test.cmd the error is "The system cannot find the file specified"). But I want the error messages to be (only or even better also) in the file. As I said, I have searched the net and tried many different combinations with >>, 2> or 2>&1, but none of them work. I believe that maybe the ability to redirect only the stderr is not supported in Windows XP.As for the .vbs, I am a new scripter and I don't know this language. So I prefer to keep things simple and use some standard commands and methods. The only .vbs I have made is for closing some windows which opens at the end of some silent installations (AppActivate, SendKeys etc). But if you want to explain me the logic of your method it is welcome. Link to comment Share on other sites More sharing options...
gunsmokingman Posted March 5, 2006 Share Posted March 5, 2006 (edited) Ok I found a Cmd Script I made a while ago it output the error you will have to edit to match your needsJust run this with out editing and on your desktop look for this file R1TestLog.txtI just prefer using VBS is all.echo off && Cls && Mode 69,3 && Color 5e:: REMOVE THE :: IF YOU ARE INSTALLING FROM A CD OR DVD DRIVE::for %%i in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do if exist %%i\SETUP.exe set CDROM=%%iset P2=Ping -n 2 127.0.0.1set P3=Ping -n 3 127.0.0.1set P4=Ping -n 4 127.0.0.1::REMOVE THE :: IF YOU ARE INSTALLING FROM A CD OR DVD DRIVE::set TEST=%cdrom%\Apps:: ADD :: IF TO THE BELOW LINE IF YOU ARE INSTALLING FROM CD OR DVD DRIVEset TEST=%Systemdrive%\Appsset TEST1=%TEST%\Cleanup.cmdset TEST2=%TEST%\ACEMCP591\ACEMCP591PRO.EXEset TEST3=%TEST%\Alcohol\AlcoholInstall.cmdset TEST4=%TEST%\Flash\FlsPlyr7Install.cmdset TEST5=%TEST%\Winamp\WinAmpInstall.cmdset Name1=Cleanup.cmdset Name2=AcePro591Install.cmdset Name3=AlcoholInstall.cmdset Name4=FlsPlyr7Install.cmdset Name5=WinAmpInstall.cmdset TESTLOG="%UserProfile%\DESKTOP\R1TestLog.txt"::Set M=Missing-^>Set Proc=Processing..Set Line=:------------------------------------------------------------------: for /f "Tokens=*" %%i in ('time /t') do set TIMET=%%ifor /f "Tokens=*" %%i in ('date /t') do set DATET=%%ifor /f "Tokens=*" %%i in ('ver') do set V=%%iTITLE START CHECK 1cls && Color f1%P3%>nul | Echo Preparing Test Your RunOnceEx.cmd::::::::::::::::CHECK FOR FILE 001 IN YOUR RUNONCETITLE CHECK %TEST1%CLS && COLOR F9:CHECK1If Exist %TEST1% Echo %Proc% %Name1% && %P3%>nul && Goto :Next1BIf Not Exist %TEST1% %Proc% %Name1% && %P3%>nul && Goto :Missing1:Missing1TITLE Missing %Name1% CLS && COLOR FC::If Exist %TESTLOG% Del /s /q %TESTLOG%echo.echo %Line% > %TESTLOG%echo %Line% >> %TESTLOG%echo %datet% %timet% : %Name1% Is Missing...!!! >> %TESTLOG%echo Windows Version : %V% >> %TESTLOG%echo %Line% >> %TESTLOG%Echo -^> This File : %Name1% Is Missing...!!! && %P3%>nul && goto :Next1agoto EOF:Next1aTITLE Failed %Name1%CLS && COLOR 2Fecho.Echo -^> %Name1% Failed Preparing Check %Name2% && %P3%>nul && GOTO :CHECK2goto EOF:Next1bTITLE Passed %Name1%CLS && COLOR 3F::If Exist %TESTLOG% Del /s /q %TESTLOG%echo.echo %Line% > %TESTLOG%echo %Line% >> %TESTLOG%echo %datet% %timet% : %Name1% Has Passed....!! >> %TESTLOG%echo Windows Version : %V% >> %TESTLOG%echo %Line% >> %TESTLOG%Echo This File : %Name1% Has Passed....!! && %P3%>nul && GOTO :CHECK2goto EOF::::::::::::::::CHECK FOR FILE 001 IN YOUR RUNONCE::::::::::::::::CHECK FOR FILE 002 IN YOUR RUNONCE:CHECK2TITLE CHECK %TEST2%CLS && COLOR 4Fif Exist %TEST2% echo %Proc% %Name2% && %P3%>nul && Goto Next2If not Exist %TEST2% Echo %Proc% %Name2% && %P3%>nul && Goto Missing2:Next2TITLE Passed %Name2%CLS && COLOR 6Fecho.echo %Line% >> %TESTLOG%echo %datet% %timet% : %Name2% Has Passed....!! >> %TESTLOG%echo Windows Version : %V% >> %TESTLOG%echo %Line% >> %TESTLOG%Echo This File : %Name2% Has Passed....!! && %P3%>nul && goto :CHECK3goto EOF:Missing2TITLE Missing %Name2% CLS && COLOR FCecho.echo %Line% >> %TESTLOG%echo %datet% %timet% : %Name2% Is Missing...!!! >> %TESTLOG%echo Windows Version : %V% >> %TESTLOG%echo %Line% >> %TESTLOG%Echo -^> This File : %Name2% Is Missing...!!! && %P2%>nul && goto :Next2agoto EOF:Next2aTITLE Failed %Name2%CLS && COLOR 2Fecho.Echo -^> %Name2% Failed Preparing Check %Name3% && %P3%>nul && GOTO :CHECK3goto EOF::::::::::::::::CHECK FOR FILE 002 IN YOUR RUNONCE::::::::::::::::CHECK FOR FILE 003 IN YOUR RUNONCE:CHECK3TITLE CHECK %TEST3%CLS && COLOR 5Fif Exist %TEST3% echo %Proc% %Name3% && %P3%>nul && Goto :Next3If not Exist %TEST3% Echo %Proc% %Name3% && %P3%>nul && Goto :Missing3:Next3TITLE Passed %Name3%CLS && COLOR 6Fecho.echo %Line% >> %TESTLOG%echo %datet% %timet% : %Name3% Has Passed....!! >> %TESTLOG%echo Windows Version : %V% >> %TESTLOG%echo %Line% >> %TESTLOG%Echo This File : %Name3% Has Passed....!! && %P3%>nul && goto :CHECK4goto EOF:Missing3TITLE Missing %Name3% CLS && COLOR FCecho.echo %Line% >> %TESTLOG%echo %datet% %timet% : %Name3% Is Missing...!!! >> %TESTLOG%echo Windows Version : %V% >> %TESTLOG%echo %Line% >> %TESTLOG%Echo The %Name3% Is Missing...!!! && %P3%>nul && goto :Next3agoto EOF:Next3aTITLE Failed %Name3%CLS && COLOR 2Fecho.Echo -^> %Name3% Failed Preparing Check %Name4% && %P3%>nul && GOTO :CHECK4goto EOF::::::::::::::::CHECK FOR FILE 003 IN YOUR RUNONCE::::::::::::::::CHECK FOR FILE 004 IN YOUR RUNONCE:CHECK4TITLE CHECK %TEST4%CLS && COLOR 5Fif Exist %TEST4% echo %Proc% %Name4% && %P3%>nul && Goto Next4If not Exist %TEST4% Echo %Proc% %Name4% && %P3%>nul && Goto Missing4:Next4TITLE Passed %Name4%CLS && COLOR 6Fecho.echo %Line% >> %TESTLOG%echo %datet% %timet% : %Name4% Has Passed....!! >> %TESTLOG%echo Windows Version : %V% >> %TESTLOG%echo %Line% >> %TESTLOG%Echo This File : %Name4% Has Passed....!! && %P3%>nul && goto CHECK5goto EOF:Missing4TITLE Missing %Name4% CLS && COLOR FCecho.echo %Line% >> %TESTLOG%echo %datet% %timet% : %Name4% Is Missing...!!! >> %TESTLOG%echo Windows Version : %V% >> %TESTLOG%echo %Line% >> %TESTLOG%Echo The %Name4% Is Missing!!!! && %P3%>nul && goto :Next4agoto EOF:Next4aTITLE Failed %Name4%CLS && COLOR 2Fecho.Echo -^> %Name4% Failed Preparing Check %Name5% && %P3%>nul && GOTO :CHECK5goto EOF::::::::::::::::CHECK FOR FILE 004 IN YOUR RUNONCE::::::::::::::::CHECK FOR FILE 005 IN YOUR RUNONCE:CHECK5TITLE CHECK %TEST5%CLS && COLOR 5Fif Exist %TEST5% echo %Proc% %Name5% && %P3%>nul && Goto Next5If not Exist %TEST5% Echo %Proc% %Name5% && %P3%>nul && Goto Missing5:Next5TITLE Passed %Name5%CLS && COLOR 6Fecho.echo %Line% >> %TESTLOG%echo %datet% %timet% : %Name5% Has Passed....!! >> %TESTLOG%echo Windows Version : %V% >> %TESTLOG%echo %Line% >> %TESTLOG%echo %Line% >> %TESTLOG%Echo This File : %Name5% Has Passed....!! && %P3%>nul && goto quitgoto EOF:Missing5TITLE Missing %Name5% CLS && COLOR FCecho.echo %Line% >> %TESTLOG%echo %datet% %timet% : %Name5% Is Missing...!!! >> %TESTLOG%echo Windows Version : %V% >> %TESTLOG%echo %Line% >> %TESTLOG%echo %Line% >> %TESTLOG%Echo The %Name5% Is Missing!!!! && %P3%>nul && goto :Next5agoto EOF:Next5aTITLE Failed %Name4%CLS && COLOR 2Fecho.Echo -^> %Name4% Failed Preparing Check %Name5% && %P3%>nul && GOTO :quitgoto EOF::::::::::::::::CHECK FOR FILE 005 IN YOUR RUNONCE:quitTITLE Gsm Good Bye! CLS && COLOR F1echo.Echo Gsm RunOnceEx Test Completed && %P4%>nulexit The logic is I could make a far smaller script then the above. VBS Script of the same cmd file Dim Act, ChkCmd, Dtop, Fso, Line,Report_R1, SD, strChkCmd, Ts Set Act = CreateObject("Wscript.Shell") Set Fso = CreateObject("Scripting.FileSystemObject") SD = Act.ExpandEnvironmentStrings("%Systemdrive%\Apps") Dtop = Act.SpecialFolders("Desktop") Report_R1 = Dtop & "\R1_Instal.log" Line = Chr(171) & " ---------------------------------- " & Chr(187) Set Ts = Fso.OpenTextFile(Report_R1,2,True) ChkCmd = Array(SD & "\ACEMCP591\ACEMCP591PRO.EXE",SD & "\Alcohol\AlcoholInstall.cmd",_ SD & "\Cleanup.cmd",SD & "\Flash\FlsPlyr7Install.cmd",SD & "\Winamp\WinAmpInstall.cmd") For Each strChkCmd In ChkCmd If Fso.FileExists(strChkCmd)Then Act.Popup "Confirm File" & vbCrLf & strChkCmd,3,"Confirm", 0 + 32 Ts.WriteLine "Confirm This File Was There" & vbCrLf & strChkCmd & vbCrLf & "Install Started At : " & Now() & vbCrLf & Line '''' UNCOMMENT THE BELOW LINE TO MAKE ACTIVE '' Act.Run(strChkCmd),1,True Else Act.Popup "Error Missing File" & vbCrLf & strChkCmd,3,"Missing", 0 + 32 Ts.WriteLine "Cannot find This File" & vbCrLf & strChkCmd & vbCrLf & "Error Time And Date : " & Now() & vbCrLf & Line End If Next Ts.Close Act.Run(Chr(34) & Report_R1 & Chr(34)),1,False Edited March 5, 2006 by gunsmokingman Link to comment Share on other sites More sharing options...
jaclaz Posted March 5, 2006 Share Posted March 5, 2006 (edited) Just for the record:somebat.cmd > mylog.txtWill REPLACE the contents of mylog.txt with the output of the command somebat.cmd, i.e. if the somebat.cmd has multiple output and the last one is an empty line, the resulting mylog.txt will be EMPTY.somebat.cmd >> mylog.txtWill APPEND to the contents of mylog.txt the output of the command somebat.cmd, i.e. if the somebat.cmd has multiple output and the last one is an empty line, the resulting mylog.txt will be a log of all outputs + an empty line.What you need to log is "standard output", NOT "standard error":http://www.robvanderwoude.com/redirection.htmljaclaz Edited March 6, 2008 by jaclaz Link to comment Share on other sites More sharing options...
har-vas Posted March 6, 2006 Author Share Posted March 6, 2006 Hi all. Thank you for your support. Here is my feedback after a real format: I am using the line "%systemdrive%\Installations.cmd 2>%systemdrive%\Errors.log" (quotes are necessary) under [GuiRunOnce] section of Winnt.sif and I have the result I want. During the first logon, I can see the real-time output of Installations.cmd in the command prompt, except from any errors that are being logged to the Errors.log. Indeed, after the load of the shell, I can see this file in my C:\ (systemdrive) which does have the error messages only. Jaclaz, if I use your commands, I will redirect the standard output so I won't be able to see the progress of my installations. I want only the errors from my batch to be logged in the Errors.log file for troubleshooting purposes.What is really strange is this: When I was making some tests from the run box with the command "test.cmd 2>Errors.log", I was using a copy command in it to copy a non-existent file. Despite the 2> operator, the created error "The system cannot find the file specified" was displaying to the command prompt window and not to the destination file (errors.log), which was empty. When I decided to add more errors in my test.cmd ("ech Hi all" and "del C:\yo.rm"), I ascertained that these error messages was not being displayed in the prompt but in the errors.log ('ech' is not recognized as an internal or external command, operable program or batch file. Could Not Find C:\yo.rm). So I understood that my syntax was correct, the file was being created and it was recording the errors normally, except from the error with the copy command. This screw-up made me to post here and now I know that Jbm's reply was correct. As I said, during the first logon at my real windows setup, the command worked great and redirected the standard error stream to the Errors.log file. Under those circumstances, the error message "The system cannot find the file specified" is normally being logged in my log file. I can't understand why it's not the same from the run box. Link to comment Share on other sites More sharing options...
Yzöwl Posted March 6, 2006 Share Posted March 6, 2006 (edited) The output about not finding the file isn't stderr, therefore it is not redirected as such.I can copy what the guy below me has written without error, however since he hasn't written anything yet, I am not given the opportunity to do so, it is not my copying that therefore has an error.As the message stated, it cannot find the file, it is the finding which is the problem not the copying. This leads me to an obvious response, fix your coding to prevent these eventualities first.IF EXIST "E:\To Be Copied\A File.ext" COPY "E:\To Be Copied\A File.ext" "G:\Somewhere Else"2>NUL<Edit>I have used NUL, whereas you would obviously use your chosen file, and possibly, depending upon your requirements, append, (>>).</Edit> Edited March 6, 2006 by Yzöwl Link to comment Share on other sites More sharing options...
jaclaz Posted March 6, 2006 Share Posted March 6, 2006 The output about not finding the file isn't stderr, therefore it is not redirected as such.Yes, that's what I meant........just an idea, but you could use a TEE external command:http://www.robvanderwoude.com/tee.htmlhttp://www.kilowattsoftware.com/PoofPage.htmhttp://gnuwin32.sourceforge.net/packages/coreutils.htmjaclaz Link to comment Share on other sites More sharing options...
har-vas Posted March 7, 2006 Author Share Posted March 7, 2006 Hi all. Jaclaz, I think that this tee command is very useful, but I can't get it worked. As I said, the best solution would be to copy everything both in the screen and in a log file. Can you please help me with the syntax? Give me a real example if you can. I am using this simple .cmd but no log file creation. I get the "file not found" error, after the dir results and if I create myself an empty mylog.log file, it keeps to be empty after the batch execution. Keep in mind that I am a new scripter. I have installed the GNUwin32 package and copied the tee.exe into system32. The description of the command didn't help me.@echo offdir F:\ ¦ tee -a C:\mylog.logsleep 5EXITYzowl, I understood that when the system cannot find a file to copy (or whatever), it's not a stderr but a stdout. That's why when I run my test.cmd from run box I see this message in the command prompt and not in the log. But why during the execution of my script (GuiRunOnce) these messages were being logged in my errors.log? I had 3 lines with the error "The system cannot find the file specified". Also, what I gain if I use the "if exist" command? I tried it and find out that the message "The system cannot find the file specified" is not displayed anywhere. The good point whould be to have a log entry: "The file E:\To Be Copied\A File.ext doesn't exist". So I would know that I have to put that file there. If I use this method, I won't even know about any errors. Here is my test.cmd:@echo offEcho ready for the step one.if exist "C:\yo.rm" COPY "C:\yo.rm" "F:\" 2>errors.logsleep 5EXIT Link to comment Share on other sites More sharing options...
gunsmokingman Posted March 7, 2006 Share Posted March 7, 2006 VBS script are better at error catching then cmd scripts. Link to comment Share on other sites More sharing options...
har-vas Posted March 8, 2006 Author Share Posted March 8, 2006 Hi. Gunsmokingman, can you help me with this script? It is just for closing the "Found new hardware" wizard during Alcohol 120% installation. I want to run Alcohol195.exe from my CD (from the same folder as .vbs) like all the other applications. But if I use the WshShell.Run ("Alcohol195.exe"), it pops-up an error in line 2 (during the first logon from GuiRunOnce) saying that the system cannot find the file. Now I put the exe in my systemdrive (using $OEM$) and I use the following syntax.Set WshShell = WScript.CreateObject("WScript.Shell")WshShell.Run ("%systemdrive%\Alcohol195.exe")WScript.Sleep 8000WshShell.SendKeys "{DOWN}"WScript.Sleep 300WshShell.SendKeys "{TAB}"WScript.Sleep 300WshShell.SendKeys "{ENTER}"WScript.Sleep 300WshShell.SendKeys "{TAB}"WScript.Sleep 300WshShell.SendKeys " "WScript.Sleep 300WshShell.SendKeys "{TAB}"WScript.Sleep 300WshShell.SendKeys "{TAB}"WScript.Sleep 300WshShell.SendKeys "{TAB}"WScript.Sleep 300WshShell.SendKeys "{ENTER}"WScript.Sleep 2000WshShell.SendKeys "{ENTER}"WScript.QuitThe strange is that if I use the WshShell.Run ("Alcohol195.exe") command from the HDD (both .exe and .vbs in C:\), it starts the installation normally. Can you help me? Maybe this is the correct syntax: WshShell.Run (".\Alcohol195.exe")? Is there any way to convert the following code to .vbs, so I can use the %cdrom% variable in the .vbs and give a full path? Thanks.set tagfile=\WIN51for %%i in (c d e f g h) do if exist "%%i:%tagfile%" set cdrom=%%i: Link to comment Share on other sites More sharing options...
gunsmokingman Posted March 8, 2006 Share Posted March 8, 2006 (edited) What this script doesChecks to see if if CD or DVD driveChecks to see if the CD or DVD has something in itThen it checks for this file "CD_DVD_DRIVE:\Apps\Alcohol120\setup.msi" Then it start the install If it cannot find the file then it waits for you to place the correct Disk in the drive. It will loop 6 times for a total of 60 seconds. Then it self closes. This script can be ran from any where on the local computer.Save as InstallAlcohol120.vbsTo edit this vbs script ":\Apps\Alcohol120\setup.msi" change this color text to what you needthis change the file it looks for." /qb /norestart" and change this to what you needDim Act, Cmd1, Fso, Drv, strDrive,CT : CT = 0 Set Act = CreateObject("Wscript.shell") Set Fso = CreateObject("Scripting.FileSystemObject") Cmd1 = ":\Apps\Alcohol120\setup.msi" Alcohol120 Function Alcohol120 Do CT = CT + 1 Set Drv = Fso.Drives For Each strDrive In Drv If strDrive.DriveType = 4 Then If strDrive.IsReady = True Then If Fso.FileExists(strDrive.DriveLetter & Cmd1) Then Act.Run(strDrive.DriveLetter & Cmd1 & " /qb /norestart"),1,True : WScript.Quit End If Else If strDrive.IsReady = False Then ZZ1 = Act.Popup ("The CD Or DVD Does Not Appear Ready" & vbCrLf & strDrive.DriveLetter & ":\" &_ vbCrLf & "Ok to contiue" & vbTab & "Cancel to quit", 10,"Continue Or Quit : " & CT, 5 + 48) If ZZ1 = vbretry Then : End If If ZZ1 = vbcancel Then : WScript.Quit : End If If ZZ1 = -1 Then : End If If CT = 6 Then : Act.Popup "The defualt time occur preparing to stop script", 5,"Time out Error", 0 + 32 : WScript.Quit : End If End If End If End If Next Loop Until CT = 6 End Function I use alcolhol 120 and I use the msi instaed of the exe Edited March 8, 2006 by gunsmokingman Link to comment Share on other sites More sharing options...
MHz Posted March 8, 2006 Share Posted March 8, 2006 Hi. Gunsmokingman, can you help me with this script? It is just for closing the "Found new hardware" wizard during Alcohol 120% installation. I want to run Alcohol195.exe from my CD (from the same folder as .vbs) like all the other applications. But if I use the WshShell.Run ("Alcohol195.exe"), it pops-up an error in line 2 (during the first logon from GuiRunOnce) saying that the system cannot find the file. Now I put the exe in my systemdrive (using $OEM$) and I use the following syntax.The strange is that if I use the WshShell.Run ("Alcohol195.exe") command from the HDD (both .exe and .vbs in C:\), it starts the installation normally.If you manually start a VBS from where it is, then it's working directory is where it is. Executing from the registry, usually means that the systemdrive is the working directory, so it is not strange for your script to fail.This is what I would trySet WshShell = WScript.CreateObject("WScript.Shell")Dim ScriptFullPathScriptFullPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "")if WshShell.CurrentDirectory <> ScriptFullPath Then WshShell.CurrentDirectory = ScriptFullPathend ifWshShell.Run ("Alcohol195.exe")WScript.Sleep 8000WshShell.SendKeys "{DOWN}"WScript.Sleep 300WshShell.SendKeys "{TAB}"WScript.Sleep 300WshShell.SendKeys "{ENTER}"WScript.Sleep 300WshShell.SendKeys "{TAB}"WScript.Sleep 300WshShell.SendKeys " "WScript.Sleep 300WshShell.SendKeys "{TAB}"WScript.Sleep 300WshShell.SendKeys "{TAB}"WScript.Sleep 300WshShell.SendKeys "{TAB}"WScript.Sleep 300WshShell.SendKeys "{ENTER}"WScript.Sleep 2000WshShell.SendKeys "{ENTER}"WScript.Quit Link to comment Share on other sites More sharing options...
jaclaz Posted March 8, 2006 Share Posted March 8, 2006 har-vasTry using this other version of tee:http://www.csc.calpoly.edu/~bfriesen/software/console.shtmlhttp://www.csc.calpoly.edu/~bfriesen/softw...files/tee32.zipTee32 3.2 Copyright 2002 Brian FriesenUsage: <command> | tee <filename> [/A]Splits output such that it goes to both <filename> and the screen. /A appends to the fileThis is the one I use, in the other post I forgot to put the link to it...jaclaz Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now