Jump to content

Yzöwl

Patron
  • Posts

    4,113
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United Kingdom

Everything posted by Yzöwl

  1. Of course there's a chance, I highlighted that fact towards the beginning of this Topic. Even simple things such as this are a problem:
  2. Well that's all you're getting, you are not selling something for which I or other Members have provided the expertise. Topic Closed.
  3. You don't need to ask for a Product Key in order to provide the PID, you can simply get it from the registry: @FOR /F "TOKENS=3" %%# IN ('REG QUERY HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION /V PRODUCTID^|FIND "REG_"') DO @ECHO=%%#
  4. Here's a script which should do at least what you require! @ECHO OFF SETLOCAL ENABLEEXTENSIONS FOR %%! IN ( "X:\Path To\Some Directory" "X:\Same Path To\Another Directory" "X:\Different Path To\A Folder" ) DO ( CALL :CN "%%~f!\*" # CALL ECHO=Of %%#%% file(s^) located in %%~f! DEL/Q "%%~f!\*.*" CALL :CN "%%~f!\*" _ CALL SET/A £=%%#%% - %%_%% CALL ECHO=%%£%% were successfully deleted! CALL SET/A T +=%%£%% ) ECHO= ECHO=%T% files were removed during the cleanup process. ECHO= PAUSE GOTO :EOF :CN SET "%2=0" FOR %%$ IN (%1) DO SET/A %2 +=1All you need to do is change the example paths I've provided, (lines 4-6), to the ones you're cleaning.
  5. Thanks for the reply, I didn't realise you were classing those as projects.
  6. I'm interested to know which projects you've done!
  7. Read Number 3 on the instructions here!
  8. The CMD Prompt can see the particular file you mentioned! Try providing us with the exact commands you are issuing, their respective results and an indication of when and how you are running them.
  9. You should not really be setting a system variable which holds a fixed path hidden to the end user and with no pre-checks, error trapping etc.
  10. I'm afraid you will have to read and learn! We are not paid to teach and provide tutorials on request; (there are site which will do that for you, although a cost will be attributed to the questioner).
  11. Just to expand on jaclaz's idea a little, here's a more lengthy script which includes some of the more common 'translations' @ECHO OFF SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION SET "_url=%*" CALL SET "_url=!_url:%%=§!" SET "_url=!_url:§2A=*!" SET "_url=!_url:§27='!" SET "_url=!_url:§28=(!" SET "_url=!_url:§29=)!" SET "_url=!_url:§3B=;!" SET "_url=!_url:§3A=:!" SET "_url=!_url:§40=@!" SET "_url=!_url:§26=&!" SET "_url=!_url:§3D==!" SET "_url=!_url:§2B=+!" SET "_url=!_url:§24=$!" SET "_url=!_url:§2C=,!" SET "_url=!_url:§2F=/!" SET "_url=!_url:§3F=?!" SET "_url=!_url:§23=#!" SET "_url=!_url:§5B=[!" SET "_url=!_url:§5D=]!" SET "_url=!_url:§3C=<!" SET "_url=!_url:§3E=>!" SET "_url=!_url:§7E=~!" SET "_url=!_url:§2E=.!" SET "_url=!_url:§22="!" SET "_url=!_url:§7B={!" SET "_url=!_url:§7D=}!" SET "_url=!_url:§7C=|!" SET "_url=!_url:§5C=\!" SET "_url=!_url:§2D=-!" SET "_url=!_url:§60=`!" SET "_url=!_url:§5F=_!" SET "_url=!_url:§5E=^!" SET "_url=!_url:§25=%%!" SET "_url=!_url:§20= !" SETLOCAL DISABLEDELAYEDEXPANSION CALL SET "_url=%%_url:§21=!%%" SET _url PAUSE
  12. What you require can be done in pure batch, and obviously with the use of third party utilities. What happens if you have multiple files in which the content potentially overwrites content of another, how do you decide which line takes precedence when your script orders it? Are you sure that alphabetical will not mean overwriting something which should take precedence. If the file for instance works in linear form meaning line 20 will always be processed after line 19, what happens if line 21 only happens if line 19 is set to 0, but line 20 alphabetically changed that to 1 because line 22 onwards only worked if if the data was set to 1. I know its hard to explain but that's why it is generally easier to allow each individual file to run in sequence. I could of course just provide a routine for you, (but then I could simply post it as my own project and take all the credit for it myself). It is after all close to what HFSLIP should have been, had its not become bloated with pointless additions and spoiled by poor/unmanageable scripting.
  13. Other than all of your running chrome processes, I cannot see anything wrong in the log you posted. If you are worried about all of the (file missing) messages, that is because you are running a tool not designed for a 64bit OS on a 64bit OS.
  14. You would need to modify any disk in order to provide a working CDROM driver compatible with the particular unit on the PC you required it for.
  15. Well if I was going to use a command script then I'd certainly use variables and wouldn't bother with the non-required /f or /t switches.@ECHO OFF SETLOCAL SET "K_=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation" REG ADD "%K_%" /v Manufacturer /d "Test" REG ADD "%K_%" /v Model /d "Se7en" REG ADD "%K_%" /v SupportPhone /d "123-456-7890" REG ADD "%K_%" /v SupportURL /d "http://www.test.com" REG ADD "%K_%" /v Logo /d "%SystemRoot%\system32\oemlogo.bmp"
  16. Scripts which are required to output localized Strings are often going to have to be altered for each environment. The example you have posted above is basically Bilingual, we could perhaps expand it by adding German, but where would it end?
  17. Since you've had a hybrid VBScript batch and an AutoIt solution, I thought I'd provide the hybrid batch solution using JScript as I suggested earlier: DateStrMon.cmd @if (@X)==(@Y) @goto :Dummy @end/* Batch part @echo off for /f "tokens=*" %%# in ('cscript //nologo //e:jscript "%~f0"') do echo=%%# pause goto :eof Jscript part */ var currMonth, currDate, currYear; var dateObj = new Date(); var monthsArr = new Array(); currMonth = dateObj.getMonth(); currDate = dateObj.getDate(); currYear = dateObj.getFullYear(); monthsArr[0] = "January"; monthsArr[1] = "February"; monthsArr[2] = "March"; monthsArr[3] = "April"; monthsArr[4] = "May"; monthsArr[5] = "June"; monthsArr[6] = "July"; monthsArr[7] = "August"; monthsArr[8] = "September"; monthsArr[9] = "October"; monthsArr[10] = "November"; monthsArr[11] = "December"; WScript.Echo(monthsArr[currMonth] + " " + currDate + ", " + currYear);
  18. In answer to your first question >C:\file.txt ECHO=%DATE:~-10% For your second question, It can be done through a For loop with a counter and comparing the counter with the month name, but unless it is for a specific known locale etc. only I'd strongly suggest using something other than batch only functions for this stuff, (perhaps JScript).
  19. Note that in my examples I added double-quotes to the registry key due to the space in its path.
  20. You're still not really helping me much here! What are you wanting to be output? Is your requirement tab or space delimited as opposed to comma? Why are you using WMIC as opposed to other methods? What operating system(s)? What is the exact command line you are using? I asked for information and what you've supplied is very little. These things go a lot easier if we don't keep on providing you with answers then wait for you to give us reasons why it will not work for you. If you provide us with as much as possible to begin with it saves us wasting our time pointlessly.
  21. There are always a host of ways of preforming tasks, however, you cannot change the output order from the WMIC command. You would need to use another method of obtaining the data or sort the data from the output prior to importing it. It is a two way process, I am not going to provide suggestions or solutions with insufficient information, so you'll need to fulfil that side of the process.
  22. When you redirect output, you can chose to redirect STDERR and/or STDOUT. STDERR is redirected thus 2>erroutput.log STDOUT is redirected 1>output.log, the 1 is assumed as default. The problem is that it appears to the command parser as if you've included the 1; and because it was assumed it was therefore dropped, (removed). It would be good practice to always include it and/or always include the space. ECHO=HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB975254","Installed",0x10001,1 1>>entries_KB975254.ini ECHO=HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB975254","Comments",,"Security Update for Windows XP (KB975254)" 1>>entries_KB975254.ini My preference is to move the redirection to the other end of the command line @ECHO OFF SETLOCAL SET "HFKEY=SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix" >entries_KB975254.ini ( ECHO=HKLM, "%HFKEY%\KB975254", "Installed", 0x10001, 1 ECHO=HKLM, "%HFKEY%\KB975254", "Comments", ,^ "Security Update for Windows XP (KB975254)" )
  23. For windows xp updates, you can probably get away with simply changing MSU to EXE and removing WUSA. @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"
  24. That is correct. Do bear in mind that WUSA.EXE is located within %PATH% as is SHUTDOWN.EXE and that executables located within the path do not require their path prepending to the command. You have done so with one and not the other, whilst both are correct it seems pointless to include that which isn't required. You can also simplify lines 2 & 3 by merging them into one thus @ECHO OFF SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION FOR /R "%~dp0" %%A IN (*-KB*.MSU) DO ( CALL :SUB %%~nA ECHO= Installing KB!KB_NUM! >NUL TIMEOUT /t 3 WUSA "%%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"
  25. Just thought I'd add a note about the use of the /R switch with FOR in this case. You are recursing the directory rooted at the current directory, not necessarily that of the batch files location. If you wanted to make sure of that I'd suggest that you think about using either: FOR /R C:\Post_SP1 %%A IN (or FOR /R %~dp0 %%A IN (You may of course need to ensure that paths with spaces are catered for too!
×
×
  • Create New...