dimanche 14 juin 2020

simple if statement using batch not working as expected [duplicate]

im using sccm to push a batch script to detect the contents of a folder and then write this information back to a network share for further investigation. the key being i need to know the user and pc name that the information relates to hence the create folder with username and pc name

    @echo off
If exist c:\windows\minidump\*.dmp (
      mkdir \\Networkpath\%username%-%Computername% 
      set "NewFolder=\\Networkpath\%username%-%Computername%"
      dir c:\windows\minidump\* /b /a-d >%NewFolder%\bsod.txt
)

its rather basic as im not so good with these things. it doesnt appear to work as expected as when i deployed it the script was writing back folders that were empty. do i need to state what should happen if it does not exist? any help would be much appreciated

Aucun commentaire:

Enregistrer un commentaire