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. In that case you can do it without the for loop and get rid of the first two lines.Place the following code as your runoceex key data instead: "%systemroot%\system32\mshta.exe \"%~d0\wpi\wpi.hta\""
  2. Unfortunately, you can't Start a service if it's set to Disabled so the state has to be changed first. I was aware of that at the time of posting, as you will note by my full response. However since you have brought it up and I as a result of not fully answering the question haven't slept well in the last 2½ years, the following will do as requested.@ECHO OFF&SETLOCAL SET "_=servicename1 servicename2 servicename3" FOR %%? IN (%_%) DO (CALL :CS_ %%? IF ERRORLEVEL 4 SC CONFIG %%? START= AUTO) GOTO :EOF :CS_ FOR /F "TOKENS=2 DELIMS=: " %%? IN ( 'SC QC %1^|FIND "START_TYPE"') DO EXIT/B %%? GOTO :EOFI'm not sure that the service would need starting as well, especially at login. If that is necessary then the appropriate line could be added to the batch file code now provided.
  3. No you don't, we're simply fixing a broken shortcut the desktop locaton has no relevance.
  4. There shouldn't be a reason why not! Const CDtop = &H19& Const UDtop = &H10& Set oApp = CreateObject("Shell.Application") Set oShell = CreateObject("WScript.Shell") Set oFso = CreateObject("Scripting.FilesystemObject") ' String in the target property to search for sTargetStrOld = "C:\Program Files\OldProgDir\executable.exe" ' New string to set sTargetStrNew = "C:\Program Files\NewProgDir\executable.exe" Set oDir = oApp.Namespace(CDtop) Set oDItem = oDir.Self sLocn1 = oDItem.Path Set oDir = oApp.Namespace(UDtop) Set oDItem = oDir.Self sLocn2 = oDItem.Path ChkLnk(sLocn1) ChkLnk(sLocn2) Sub ChkLnk (sFolder) Set oFolder = oFso.GetFolder(sFolder) Set oFiles = oFolder.Files For Each oFile In oFiles If LCase(oFso.GetExtensionName(oFile)) = "lnk" Then Set oLnk = oShell.CreateShortcut(oFile) If LCase(oLnk.TargetPath) = LCase(sTargetStrOld) Then oLnk.TargetPath = sTargetStrNew oLnk.Save End If End If Next End Sub
  5. Well it seems from what you've posted that the task is a lot simpler than I'd presumed. I thought that the shortcut you were hoping to deploy was for an application on the server. To do what you'd originally hoped for something like this would probably suffice: Const CommonDesktop = &H19& Const OverwriteExisting = TRUE 'Shortcut strSC = "\\Server\Share\link.lnk" Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace(CommonDesktop) Set objFolderItem = objFolder.Self strAUDesktop = objFolderItem.Path Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.CopyFile strSC, strAuDesktop, OverWriteExisting If you wanted to do as I originally intimated, i.e search all shortcuts on the all users desktop for a the old string and replace it with the new one, you could try something like this Const CDtop = &H19& Set oApp = CreateObject("Shell.Application") Set oShell = CreateObject("WScript.Shell") Set oFso = CreateObject("Scripting.FilesystemObject") ' String in the target property to search for sTargetStrOld = "C:\Program Files\OldProgDir\executable.exe" ' New string to set sTargetStrNew = "C:\Program Files\NewProgDir\executable.exe" Set oDir = oApp.Namespace(CDtop) Set oDItem = oDir.Self sLocn = oDItem.Path ChkLnk(sLocn) Sub ChkLnk (sFolder) Set oFolder = oFso.GetFolder(sFolder) Set oFiles = oFolder.Files For Each oFile In oFiles If LCase(oFso.GetExtensionName(oFile)) = "lnk" Then Set oLnk = oShell.CreateShortcut(oFile) If LCase(oLnk.TargetPath) = LCase(sTargetStrOld) Then oLnk.TargetPath = sTargetStrNew oLnk.Save End If End If Next End SubThis one should work regardless of whether the shortcut name has been changed. In both cases and the example provided by gunsmokingman, you'll note that we've used constants which specify the All Users Desktop folder regardless of its actual name/spelling etc.
  6. Welcome to The MSFN Forums, we're happy to have you here! I have created your post into a new topic, it is generally a good idea not to hijack other peoples topics with your own.
  7. My suggestion is a VBScript which searches for that specific shortcut name on the all users desktop and replaces the location of the target path with your new one.
  8. Welcome to the MSFN Forums, I trust you'll enjoy the experience. the meeting place of choice!
  9. Welcome 'The Learning Zone', MSFN Forums. where people aspire to be know-it-alls!
  10. Yzöwl

    Hey

    Welcome to the MSFN forums. We're ROCKing all over the World!
  11. Welcome to the MSFN Forums, I hope you benefit from your membership here. Just a small note in the interests of all readers: We are an international forum, please be aware that there are many beliefs among our members; and would suggest therefore not posting anything which has religious connetations. Thank you.
  12. Yzöwl

    Hi all !

    TakeControl is actually an off-site file and it's download should not have been affected your MSFN membership or number of posts. Still, It's nice to have you as an incidental member of MSFNs Forums and I hope your membership brings you further benefits.
  13. Yzöwl

    Heads Up

    Welcome, I hope you now enjoy the full benefit of MSFN membership. the person now known as Soulmate
  14. Welcome to MSFN, I hope your membership brings you fulfillment. Things can only get better, keep testing the 'tablets'.
  15. Welcome to the MSFN Forums. I'm sure that you'll be satisfied with the experience. Knowing where you want to go certainly helps when seeking direction. You've started in the right direction, MSFN
  16. Yzöwl

    hello

    Welcome ybor33, we're glad you came onboard the MSFN Express. I'm English talking, but prefer to look at the pictures!
  17. Welcome, and thank you for the kind words. I hope you enjoy the MSFN Forums if so don't forget to spread the word
  18. Welcome to the MSFN Forums. one of the best places to hang around!
  19. Well the people who run this site are the most important ones Welcome to our little corner of the internet, I hope you enjoy your learning experience.
  20. Yzöwl

    Hello

    Welcome to the MSFN Forums. If it's knowledge you crave, you've come to the right place, MSFN. If it's warmth you crave, then you'll need to fly south!
  21. Yzöwl

    hi

    Its nice of you to say so and as a result I'm impressed with your introductory post Welcome to the MSFN Forums.
  22. Welcome to 'The Forums', we're happy to have you! Although not grammatically correct, your English is perfectly understandable.
  23. Using the WMI method you could even go one step further and create a single new one for the customer too.Set SRP = GetObject("winmgmts:\\.\root\default:SystemRestore") DSRP = SRP.Disable("") ESRP = SRP.Enable("") CSRP = SRP.CreateRestorePoint ("Factory Settings", 0, 100)BTW, I don't think that the wait between disable and enable is necessary.
  24. Because it is faster. It would obviously be the best location for "any" file and with more than 80 free space, they should be there IMHO.My point remains, what particular reason do you have to require your swap file at the fastest part of the disk. You need to look at your actual swap file usage, if it is being used often enough for its disk location to make any real difference, i.e. accessed most frequently, then you should really be looking at increasing your RAM as suggested by gosh!BTW thanks cluberti for your input and saving me a large amount of typing!
×
×
  • Create New...