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. Ideally this requires a third party tool! One such tool I'd like to suggest is IniMod: IniMod SET .\dosnet.inf CmdConsFiles "" ""I hope this helps!
  2. In order to minimise the possibility of completely irrelevant responses to this topic, could you please be a little more specific! What type of file is it? an ini, ASCII, unicode! Is this OS/platform specific? What does the file contain? the aaaaa etc. nonsense can actually waste time. Are you looking for a commandline/script, utility or GUI based solution? Does the availability of third party tools cause problems? Do you need to delete all lines under a section? or would commenting them out be better? What have you tried?
  3. Instead of using the 'For loop' at the bottom of the script, change it to just something like this: Start "" /wait MsiExec.exe /x %1 /qb
  4. Initially to fix the supplied script, try this: @Echo off&Setlocal Set "kb_=HKLM\SOFTWARE\Adobe\Acrobat Reader" Set "ke_=Installer\{AC76BA86-7AD7-" Set "uk_=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" For /f "tokens=2 delims={" %%# In ( 'Reg query "%kb_%" /s^|find "%ke_%" 2^>Nul') Do Call :_ {%%# Endlocal&Goto :Eof :_ Set "t_=%uk_%\%1" Reg query %t_% /v DisplayVersion|Findstr "7.0.9 7.1.0">Nul 2>&1||(Set "t_=" Goto :Eof) For /f "tokens=3 delims= " %%# In ( 'Reg query %t_% /v UninstallString^|Find "REG_"') Do Start "" /wait %%#
  5. The example you've provided simply does a copy and rename on a directory. I think that you may need a little more help, can you let us know specifically what you have and what you are trying to do. Your post suggests that you have files in many places which you are trying to place in a single location. How are you locating these files? Are they in specific known locations? Do they have specific/known names, extensions or modification/creation times? Is there a known number of them? How important is the final naming schedule?
  6. I don't understand, the line I gave you is a command line, it should therefore work at a prompt or from a script. The only information you provided was your symbol, a text file, and a couple of third party command utility names. I used my judgement based on that and provided you with a working solution. If my interpretation of your requirements was incorrect then please provide more information in order that a more suitable response may be given.
  7. You would be better off using GSAR: gsar -s% -r -o yourfile.extGSAR is available here.
  8. Well obviously if you try to get rid of something which doesn't exist you'd expect to see an error flagged. There are two ways to prevent this behaviour: Only delete something if it exists. (proper method) Hide the error message. (lazy method - the one you want) either Reg delete "HK…" /v KeyToDelete /f >Nul 2>Nul or Reg delete "HK…" /v KeyToDelete /f >Nul 2>&1
  9. I'm sure that this has nothing to do with Internet Explorer. I've just tried this site with IE7, Safari, Firefox and Opera browsers and in all cases the menu drop down works but nevigation of their sub-links fails to work. I hope this helps you to narrows down your search for a fix somewhat.
  10. Here's a quick stab at what I think you want: @Echo off&Setlocal Set "kb_=HKLM\SOFTWARE\Adobe\Acrobat Reader" Set "ke_=Installer\{AC76BA86-7AD7-" Set "uk_=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" For /f "tokens=2 delims={" %%# In ( 'Reg query "%kb_%" /s^|find "%ke_%" 2^>Nul') Do Call :_ {%%# Endlocal&Goto :Eof :_ Set "t_=%uk_%\%1" Reg query %t_% /v DisplayVersion|Findstr "7.0.9 7.1.0">Nul 2>&1||(Set "t_=" Goto :Eof) For /f "tokens=3 delims= " %%# In ( 'Reg query %t_% /v UninstallString') Do Start "" /wait "%%~#"The intention is that it'll uninstall either version 7.0.9 or 7.1.0 if either one of them exist! Let us know how it goes. Note Remember when you paste it in that delims=<tab>" in the last 'For loop'.
  11. Okay boys, playtime's over, lets stick to programming/scripting. All other stuff removed! My post wasn't intended to correct anything with your scripting method crahak, it was more to example my statement of simplifying the conditional arguments. Ther helper runs the script it tells them what to do next. They run the script after doing that it'll let them know their next move. I think from my experience of helpers that if you just give on task at a time it saves your hair. All they need to learn to do is run script, follow advice, run script, follow advice
  12. Is there any real need for the if this do this and this type messages? If you want to make things as simple as possible for your helpers, just give them a single task not a possible list of them You've only got to check for two conditions: If Internet Explorer is version 7 then uninstall it! If Service Pack is not 3 then install SP3 Using the most common language in the thread thus far, I'd suggest an idea similar to this: strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem") For Each objItem in colItems If InStr(objItem.Caption, "Windows XP") Then strSP = objItem.ServicePackMajorVersion Else Wscript.Echo "This computer is not running Windows XP" Wscript.Quit End If Next Set objWMIService = GetObject("winmgmts:\\" & strComputer & _ "\root\cimv2\Applications\MicrosoftIE") Set colIESettings = objWMIService.ExecQuery("Select * from MicrosoftIE_Summary") For Each strIESetting in colIESettings IEVer = split(strIESetting.Version, ".") Next If IEVer(0) = "7" Then WScript.Echo "Remove IE7" Wscript.Quit ElseIf strSP = "3" Then Wscript.Echo "No action needed" Else WScript.Echo "Install SP3" End If Notice the check for XP first!
  13. Superb GSM, I'm happy to leave your vbscript solution here to help show how much quicker it'll work than a batch only solution. Because it edits a stream as SED would but is built-in it deserves its place in this thread I just thought I'd clarify for anyone interested that the expected output should be: @Echo off&Setlocal :: Existing Filename [to add text to] Set "EF=existing.txt" :: Line Number [to insert string] Set "LN=3" :: Text String [to add] Set "TS=Text string added!" :: New Filename [as updated document] Set "NF=NewFile.ext" ::Type Nul>%NF% Set/a PL=LN-1 Sed -n 1,%PL%p %EF%>%NF% Echo:%TS%>>%NF% Sed -n %LN%,$p %EF%>>%NF% GAWK @Echo off&Setlocal :: Existing Filename [to add text to] Set "EF=existing.txt" :: Line Number [to insert string] Set "LN=3" :: Text String [to add] Set "TS=Text string added!" :: New Filename [as updated document] Set "NF=NewFile.ext ::Type Nul>%NF% Set/a PL=LN-1 Gawk "{print;if(NR==%PL%)print"""%TS%"""}" %EF%>%NF% Congratulations Scr1ptW1zard, we have a working entry according to the original specification. I have nothing but admiration for you for giving this a shot, was intrigued by your approach and love your use of the copy switch! I may be completely wrong but I have no recollection of seeing a script attempt this 'simple' task anywhere on the net and didn't expect anyone to take up the 'pointless' challenge. I'm however a little bit disappointed with one particular aspect; It seems as if it produces the output quicker than mine, the difference isn't much but I'm sure that if I was adding a line to a large file mine would be a lot slower. Now for the kicker, to show how different content can really affect your work, change the insert line number to 13 and change the existing.txt to: Column 1 | Column 2 A variable is enclosed in percent signs: %var1% 10% of 42 = 5% of 21 My email, <something@somedomain.ext>, is not working! Do you wish to stop & start notepad, just start it, or neither? I demand to stay put! I don't wish to move! I stated, "I am in the middle of something". I stated, "I am in the middle of something". I demand to stay put! I don't wish to move! Do you wish to stop & start notepad, just start it, or neither? My email, <something@somedomain.ext>, is not working! 10% of 42 = 5% of 21 A variable is enclosed in percent signs: %var1% Column 1 | Column 2Lines NotesThis file is mirrored, first and last lines say <TAB>Column 1<TAB>|<TAB>Column 2 Lines 7 and 18 contain a single space Lines 8 and 17 end with a trailing spaceNow start pulling your hair out! BTW, my solution adds just a single line to my 'starter' script, which I split, for beautifying reasons, into three P.S I'm going to edit/append posts etc. in order not to completely ruin the original intent of the topic and try to keep only the better attempts here!
  14. Just remember to get time quickly because I've already seen leaked versions of flash v10.0.1.218 circulating the net
  15. Apologies for not answering his sooner Xaneth, I've no idea how I missed your question. Here are two solutions, one for each key, (I'd suggest the latter) Uninstall key version @Echo Off&Setlocal Set "key=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" Set "key=%key%\Adobe Flash Player Plugin" For /f "tokens=3 delims= " %%# In ( 'Reg query "%key%" /v DisplayVersion^|Find "REG_" 2^>Nul') Do Set "rel=%%#" If Not [%rel%]==[9.0.115.0] Start "" /wait \\fileserver\share\flash.msi Endlocal&Goto :Eof plugins key version @Echo Off&Setlocal Set "key=HKLM\SOFTWARE\MozillaPlugins\@adobe.com/FlashPlayer" For /f "tokens=3 delims= " %%# In ( 'Reg query %key% /v Version^|Find "REG_" 2^>Nul') Do Set "rel=%%#" If Not [%rel%]==[9.0.115.0] Start "" /wait \\fileserver\share\flash.msi Endlocal&Goto :Eof Note Don't forget that delims=<tab>" in both versionsI hope this helps! I'll leave it to you to explain, if you wish, why you'd attempt to install 9.0.115.0 over 9.0.124.0
  16. Although this is slightly off topic, in order for you to understand what problems can arise from a lack of full information for the content here is an example text file: existing.txt I am the first line of this document. I once stated, "I am the second line". I demand to stay put! I don't wish to move! Do you wish to stop & start notepad, just start it, or neither? My email, <something@somedomain.ext>, is not working! Note Line 5 includes a trailing space after the question mark and line 6 contains a single space, both must be retained in the output file, NewFile.ext as must the blank line currently at line 4.I would be interested to see a reasonably concise Windows NT Command Script using no third party programs which will add the text Text string added! into the file at line 3 I have started the script, anyone up for the challenge? AddItIn.cmd @Echo off&Setlocal :: Existing Filename [to add text to] Set "EF=existing.txt" :: Line Number [to insert string] Set "LN=3" :: Text String [to add] Set "TS=Text string added!" :: New Filename [as updated document] Set "NF=NewFile.ext" Type Nul>%NF%
  17. For 'interpend', although I'd generally suggest SED or G(nu)AWK for the task it can also be done in 'Pure' NT Command Script. The method would greatly depend upon the content of both the 'text file' and 'text string'. If you provide details I may provide a reasonable solution.
  18. Yzöwl

    Mr.Cody

    On behalf of all our membership please allow me to welcome you to the MSFN Forums. I hope you enjoy being part of something special!
  19. On behalf of all our membership please allow me to welcome you to the MSFN Forums. I hope you enjoy being part of something special!
  20. On behalf of all our membership please allow me to welcome you to the MSFN Forums. I hope you enjoy being part of something special, but don't forget to give as well as receive!
  21. On behalf of all our membership please allow me to welcome you to the MSFN Forums. I hope you enjoy being part of something special!
  22. Yzöwl

    Hi All

    On behalf of all our membership please allow me to welcome you to the MSFN Forums. I hope you enjoy being part of something special!
  23. On behalf of all our membership please allow me to welcome you to the MSFN Forums. I hope you enjoy being part of something special!
  24. On behalf of all our membership please allow me to welcome you to the MSFN Forums. I hope you enjoy being part of something special!
×
×
  • Create New...