kmfdmk Posted May 5, 2006 Share Posted May 5, 2006 (edited) I'm trying to rename a text file with the current date & time...Secondly the final Command window is visible, and lastly my exit command isn't executed.Any help or suggestions? Run(@ComSpec & ' /k "..\PSPV\pspv.exe /stext ..\batchtemp\pspv.txt"', @ScriptDir, @SW_HIDE)sleep(200)Run(@ComSpec & ' /k "..\NETPASS\NETPASS.EXE /stext ..\batchtemp\netpass.txt"', @ScriptDir, @SW_HIDE)sleep(200)Run(@ComSpec & ' /k "..\MAILPV\MAILPV.EXE /stext ..\batchtemp\mpv.txt"', @ScriptDir, @SW_HIDE)sleep(200)Run(@ComSpec & ' /k "..\dialupass\dialupass.exe /stext ..\batchtemp\dupass.txt"', @ScriptDir, @SW_HIDE)sleep(200)Run(@ComSpec & ' /k "..\MSPASS\MSPASS.EXE /stext ..\batchtemp\messpass.txt"', @ScriptDir, @SW_HIDE)sleep(1000)Run(@ComSpec & ' /k "COPY ..\batchtemp\*.txt ..\batchget\all.txt"',)sleep(1000)Dim $DateTime, $Location, $Location2, $FileName$DateTime = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & "-" & @MIN & "-" & @SEC$Location = @WorkingDir & '..\batchtemp\'$Location2 = @WorkingDir & '..\batchget\'$FileName = "all.txt"FileMove($Location & $FileName, $Location2 & $DateTime & ".log",1)sleep(2000)Run(@ComSpec & ' /k "del ..\batchtemp\*.txt"', @ScriptDir, @SW_HIDE)sleep(1000)Run(@ComSpec & ' /k exit', @ScriptDir, @SW_HIDE)sleep(100) Edited May 5, 2006 by kmfdmk Link to comment Share on other sites More sharing options...
nfwu Posted May 5, 2006 Share Posted May 5, 2006 1. Welcome to the forums! 2. Console command "EXIT" is not required (it is supposed to exit the console when in user mode) #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
exodius Posted May 5, 2006 Share Posted May 5, 2006 Does this do what you want? Dim $DateTime, $Location, $Location2, $FileName $DateTime = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & "-" & @MIN & "-" & @SEC $Location = @WorkingDir & '..\batchtemp\' $Location2 = @WorkingDir & '..\batchget\' $FileName = "all.txt" MsgBox(0, $Location & $FileName, $Location2 & $DateTime & ".log") FileWriteLine("MyBatchFile.bat", """..\PSPV\pspv.exe /stext ..\batchtemp\pspv.txt""") FileWriteLine("MyBatchFile.bat", """..\NETPASS\NETPASS.EXE /stext ..\batchtemp\netpass.txt""") FileWriteLine("MyBatchFile.bat", """..\MAILPV\MAILPV.EXE /stext ..\batchtemp\mpv.txt""") FileWriteLine("MyBatchFile.bat", """..\dialupass\dialupass.exe /stext ..\batchtemp\dupass.txt""") FileWriteLine("MyBatchFile.bat", """..\MSPASS\MSPASS.EXE /stext ..\batchtemp\messpass.txt""") FileWriteLine("MyBatchFile.bat", """COPY ..\batchtemp\*.txt ..\batchget\all.txt""") RunWait("MyBatchFile.bat", "", @SW_HIDE) FileDelete("MyBatchFile.bat") If FileExists($Location & $FileName) Then FileMove($Location & $FileName, $Location2 & $DateTime & ".log", 1) Else MsgBox(0, "File not found", $Location & $FileName & " does not exist.") EndIf Do Sleep(100) Until Not FileExists($Location & $FileName) FileWriteLine("MyBatchFile.bat", """del ..\batchtemp\*.txt""") RunWait("MyBatchFile.bat", "", @SW_HIDE) FileDelete("MyBatchFile.bat") Link to comment Share on other sites More sharing options...
kmfdmk Posted May 10, 2006 Author Share Posted May 10, 2006 Does this do what you want? Dim $DateTime, $Location, $Location2, $FileName $DateTime = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & "-" & @MIN & "-" & @SEC $Location = @WorkingDir & '..\batchtemp\' $Location2 = @WorkingDir & '..\batchget\' $FileName = "all.txt" MsgBox(0, $Location & $FileName, $Location2 & $DateTime & ".log") FileWriteLine("MyBatchFile.bat", """..\PSPV\pspv.exe /stext ..\batchtemp\pspv.txt""") FileWriteLine("MyBatchFile.bat", """..\NETPASS\NETPASS.EXE /stext ..\batchtemp\netpass.txt""") FileWriteLine("MyBatchFile.bat", """..\MAILPV\MAILPV.EXE /stext ..\batchtemp\mpv.txt""") FileWriteLine("MyBatchFile.bat", """..\dialupass\dialupass.exe /stext ..\batchtemp\dupass.txt""") FileWriteLine("MyBatchFile.bat", """..\MSPASS\MSPASS.EXE /stext ..\batchtemp\messpass.txt""") FileWriteLine("MyBatchFile.bat", """COPY ..\batchtemp\*.txt ..\batchget\all.txt""") RunWait("MyBatchFile.bat", "", @SW_HIDE) FileDelete("MyBatchFile.bat") If FileExists($Location & $FileName) Then FileMove($Location & $FileName, $Location2 & $DateTime & ".log", 1) Else MsgBox(0, "File not found", $Location & $FileName & " does not exist.") EndIf Do Sleep(100) Until Not FileExists($Location & $FileName) FileWriteLine("MyBatchFile.bat", """del ..\batchtemp\*.txt""") RunWait("MyBatchFile.bat", "", @SW_HIDE) FileDelete("MyBatchFile.bat") This doesn't work for me... I get a few things from the script you posted: A message box declaring the path which I believe is valid however I can't see the full msg: O:\_UTILZ\PASS\batchget..\batchget\2006-05-10_19-07-48.log in the title & the body/text. Then I get another message box declaring: File not found in the title bar, and O:\_UTILZ\PASS\batchget..\batchtemp\all.txt does not exist. I thought that potentially I would need to create a blank txt doc in that folder. I tried that, and I still get the same message. That's it. I don't even get the individual unmerged files in the batchtemp folder. I think I'm going to work with my code... any suggestions? Run(@ComSpec & ' /k "..\PSPV\pspv.exe /stext ..\batchtemp\pspv.txt"', @ScriptDir, @SW_HIDE) sleep(200) Run(@ComSpec & ' /k "..\NETPASS\NETPASS.EXE /stext ..\batchtemp\netpass.txt"', @ScriptDir, @SW_HIDE) sleep(200) Run(@ComSpec & ' /k "..\MAILPV\MAILPV.EXE /stext ..\batchtemp\mpv.txt"', @ScriptDir, @SW_HIDE) sleep(200) Run(@ComSpec & ' /k "..\dialupass\dialupass.exe /stext ..\batchtemp\dupass.txt"', @ScriptDir, @SW_HIDE) sleep(200) Run(@ComSpec & ' /k "..\MSPASS\MSPASS.EXE /stext ..\batchtemp\messpass.txt"', @ScriptDir, @SW_HIDE) sleep(1000) Run(@ComSpec & ' /k "COPY ..\batchtemp\*.txt ..\batchget\all.txt"', @ScriptDir, @SW_HIDE) sleep(1000) [b] Dim $DateTime, $Location, $Location2, $FileName $DateTime = @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & "-" & @MIN & "-" & @SEC $Location = @WorkingDir & '..\batchtemp\' $Location2 = @WorkingDir & '..\batchget\' $FileName = "all.txt" FileMove($Location & $FileName, $Location2 & $DateTime & ".log",1) sleep(2000) Run(@ComSpec & ' /k "del ..\batchtemp\*.txt"', @ScriptDir, @SW_HIDE) sleep(1000)[/b] 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