/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


PS for adding reg

06/08/2016 656 views

Can anyone tell methe script to look for a file and if present add a registry.

Thanks

Answer Summary:
0 Comments   [ + ] Show comments

Comments


Answer Chosen by the Author

0
Try something like this, checking for the file is easy, writing the registry key is the pain in the ass bit unless you are using powershell 5, or you can take the easy way out and call reg.exe to write the key.

If ((Test-Path C:\TheFileYou\AreLookingFor.txt) -eq $true)
        {Write-Debug 'Write your registy key in this block'}
    Else{Write-Debug 'File not found.'}
Answered 06/09/2016 by: rileyz
Red Belt

  • Thank you!! It worked

All Answers

1
if it is windows powershell scripting you can use a "IF Exists then or else command"

https://www.google.com/search?q=if+exist+then&ie=utf-8&oe=utf-8#q=if+exist+then+windows+powershell


Answered 06/08/2016 by: SMal.tmcc
Red Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ