Jump to content

Caml Light

Member
  • Posts

    85
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Italy

Everything posted by Caml Light

  1. Yzöwl your batch works perfectly! This time i only need to modifying it to save as text all processes, so i've delete this: /FI "STATUS eq RUNNING" @ECHO OFF >processes.log TYPE NUL FOR /F "DELIMS=," %%# IN ('TASKLIST /FO "CSV" /NH') DO ( >>processes.log ECHO=%%~#) The problem now is that there are many duplicates, for ex. svchost.exe or csrss.exe are reported many times in the text file. Should you have an idea to list all processes one time only?
  2. I've Win7 SP1 x64 and tasklist looks like from you...
  3. thank you but the processes.txt file only contains this: ECHO active. ECHO active. ECHO active. ECHO active. ECHO active. ...
  4. Hi guys, with tasklist command i need to save as txt all running processes, so i've created a batch file with: TASKLIST > processes.txt At this point i would need to save as txt only the image names, without PID, session name and so on... simply a txt file in this format: csrss.exe svchost.exe taskmgr.exe wininit.exe winlogon.exe ... Is it possible to do it for you? Thank you in advance. Cheers
  5. right consideration , only using x86 post-SP1 updates for Windows 7 compressed with 7-Zip (.7z ext) 272MB -> 259MB (13MB earned), only for ONE O.S.! not bad (at least for me, clear ) Coming back in topic, have you others suggestions for me after having seen my batch structure? Thanks
  6. sometimes i decide to zip them to save space when i put them in my fullest USB pen drive So, this is a condition to consider for the batch.
  7. Directory di C:\teststructure 10/11/2011 20:23 <DIR> . 10/11/2011 20:23 <DIR> .. 08/11/2011 20:51 45.569 batch.cmd 10/11/2011 20:20 <DIR> Dir 10/11/2011 20:20 <DIR> Tools 1 File 45.569 byte Directory di C:\teststructure\Dir 10/11/2011 20:20 <DIR> . 10/11/2011 20:20 <DIR> .. 10/11/2011 20:20 <DIR> Temp 0 File 0 byte Directory di C:\teststructure\Dir\Temp 10/11/2011 20:20 <DIR> . 10/11/2011 20:20 <DIR> .. 0 File 0 byte Directory di C:\teststructure\Tools 10/11/2011 20:20 <DIR> . 10/11/2011 20:20 <DIR> .. 18/04/2011 19:54 941.568 7z.dll 18/04/2011 19:34 168.448 7z.exe 2 File 1.110.016 byte In the "Dir" directory i put the updates, now is empty, while in the "Temp" subdir i'll extract the zipped updates found in "Dir".
  8. ok guys, Yzowl has modified his original batch, as you can see here: http://www.msfn.org/board/topic/153204-cmd-option-to-jump/page__st__20 - updates are in the same directory (or in a sub-dir) of the file batch - sometimes, before to install an update, i have to extract a zip file (containing the update) in a Temp directory with 7-zip command line, for ex.: FOR /R %%A IN (filename*.ZIP) DO ( SET _=T ECHO=Extraction of %%~nA...>>install.log >NUL PING -n 4 127.0.0.1 Tools\7z x "%%A" -oDir\Temp\"%%~nA" -y ECHO=Installation of %%~nA...>>install.log >NUL PING -n 4 127.0.0.1 START /WAIT Dir\Temp\"%%~nA"\KB123456.exe /quiet /norestart RD /S /Q Dir\Temp\"%%~nA") This is my folder structure: - batch file - Tools ( dir that contains 7-Zip command line) - Dir and Temp (dir and subdir that contain updates and extracted updates) I hope you have explained better the situation. Thanks
  9. This is my batch: @ECHO OFF COLOR F9 ECHO=_%~1|FINDSTR/X "_-? _/?">NUL 2>&1||GOTO Error SETLOCAL ENABLEEXTENSIONS SET "_=" PUSHD %~dp0 FOR /R %%A IN (Windows*-KB*.EXE) DO ( SET _=T ECHO=Installation of %%~nA...>>install.log >NUL PING -n 4 127.0.0.1 "%%A" /quiet /norestart DEL /F /Q "%%A") IF NOT DEFINED _ GOTO Error :: ECHO=>>install.log ECHO=Installation complete.>>install.log >NUL PING -n 4 127.0.0.1 EXIT GOTO :EOF :Error ECHO=Errore di inizializzazione.>>install.log >NUL PAUSE My doubts are about the quotes use for commands like: START /WAIT filename and DEL/RD file/folder. Instead of: "%%A" /quiet /norestart DEL /F /Q "%%A") i could have: START /WAIT Dir\"%%~nA"\KB123456.exe /quiet /norestart RD /S /Q Dir\"%%~nA") where %%~nA is a subdirectory called with the name of the extracted file, or yet: START /WAIT Dir\"%%~nA"\KB123456.exe /quiet /norestart RD /S /Q "%Temp%\Dir") So, i would need to adjust these double quotes for these typical cases to don't fall in error.
  10. ok, so summarizing, if i have an environment variable that contain spaces (ex. %COMMONPROGRAMFILES%\filename.exe -> C:\Program Files\Common Files\filename.exe), if i write in the batch: START /WAIT %COMMONPROGRAMFILES%\filename.exe i can use or less quotes, while writing: START /WAIT "C:\Program Files\Common Files\filename.exe" i MUST use quotes Is it correct?? But simplifyng, for not commit errors can i always use quotes, also if not required because there aren't spaces (ONLY to start a program or delete file and folders with DEL/RD)? RD /S /Q "%Temp%\Dir" RD /S /Q "Updates\%%~nA" START /WAIT "Updates\%%~nA\KB123456.exe" /quiet PS: for a simple question i'm making a dust cloud (sorry)
  11. ok guys, but Yzöwl wrote this: @ECHO OFF SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION FOR /R "%~dp0" %%A IN (*-KB*.EXE) DO ( CALL :SUB %%~nA ECHO= Installing KB!KB_NUM! >NUL PING -n 4 127.0.0.1 "%%A" /quiet /norestart) ECHO= == Press any key to restart == >NUL PAUSE SHUTDOWN.EXE /r /t 0 GOTO :EOF :SUB SET "KB_NUM=%*" FOR /F "DELIMS=-" %%B IN ("%KB_NUM:*-KB=%") DO SET "KB_NUM=%%B" as you can see, this variable has quotes: "%%A" /quiet /norestart So, Tripredacus has written that it is safe to use environment variables without quotes. Could you explain me bacause in the batch i posted there are quotes? Sorry but i'm trying to understand better.
  12. Thank you, now i've more clear ideas! Only in the last case, if %Temp% variable is: C:\Users\Name Surname\AppData\Local\Temp ... as you see there is a space, so is it correct to write "%Temp%"? Thanks!!!!
  13. Hi guys, sorry for the stupid question, but i've a doubt about the use of quotes, so i would need to know if in a batch file is more correct to use: START /WAIT Updates\"%%~nA"\KB123456.exe /quiet or START /WAIT "Updates\%%~nA\KB123456.exe" /quiet RD /S /Q Updates\"%%~nA" or RD /S /Q "Updates\%%~nA" RD /S /Q %Temp%\Dir or RD /S /Q "%Temp%\Dir" or RD /S /Q "%Temp%"\Dir Thank you in advance guys, you're always very helpful!
  14. Hi guys! taking this script: @ECHO OFF COLOR F9 ECHO=_%~1|FINDSTR/X "_-? _/?">NUL 2>&1||GOTO Error SETLOCAL ENABLEEXTENSIONS SET "_=" PUSHD %~dp0 FOR /R %%A IN (ApplicationSetup.EXE) DO ( SET _=T ECHO=Installation of %%~nA...>>install.log >NUL PING -n 4 127.0.0.1 :: Extracting ApplicationSetup file "%%A" /S :: Killing processes that automatically start bin\KillProcess Setup.exe bin\KillProcess InstallApp.exe :: Start Silent Installation of the extracted files %SystemDrive%\ApplicationSetup\%%~nA\Setup.exe /S :: Delete Folder where ApplicationSetup is extracted RD /S /Q %SystemDrive%\ApplicationSetup) IF NOT DEFINED _ GOTO Error :: ECHO=>>install.log ECHO=Install complete.>>install.log >NUL PING -n 4 127.0.0.1 EXIT GOTO :EOF :Error ECHO=Error.>>install.log >NUL PAUSE So, for you is it correct? Is it better to add "START /WAIT" at the begin of every command? This script works, but i want to be sure that it can't give me errors. Thank you in advance!!
  15. thank you guys! I've solved, so now it's not necessary this procedure.
  16. Hi guys! If i have this script: @ECHO OFF ECHO=HELLO>>file.txt As result i have a file called file.txt that contains ath the first line the word "HELLO", while the second line is empty. Is it possible to have a file without the second line, but only the first line containing the word "HELLO" ?? (in this case) Thank you for your help!
  17. Ok, i can forget batch files... but, what do you suggest me?
  18. thank you for your sarcarm , but i need a method to block my software after a period of time. I can use a text file on my server to check the expiration time, but it works only if the date on the computer that runs my software is correct. Any ideas (not sarcastic)?
  19. hi guys, thanks for your replies! I need it to protect my software. So, what's the best method for you?
  20. Hi batchers! I need to get the correct date from Internet (only the current day, month and year, not hours, minutes and seconds) Here there is a working AutoIt script, but i need to do it with a CMD batch... http://www.autoitscript.com/forum/topic/18493-get-date-form-internet/ Thank you!
  21. Hi!!!! I'm thinking that it would be nice if the batch could skip the ECHO of the updates not installed. For example, if i put some hotfixes for x64 architecture on a x86 S.O., actually the installation is skipped, but the ECHO not. Is it feasible?
×
×
  • Create New...