Adapting .REG Files.

Page 9 of 13 FirstFirst ... 7891011 ... LastLast
  1. Paul Black's Avatar
    Posts : 12,191
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #81

    Thanks @Matthew Wai,

    Matthew Wai said:
    I just ran your script in post #66 and got the following:
    Code:
    Processing BAT file: "E:\Testing\Testing batch.bat".
    '/q' is not recognized as an internal or external command,
    operable program or batch file.
    Operations completed.
    Press any key to continue . . .
    I am going to look at this and try to get this working today!
      My Computer

  2. Paul Black's Avatar
    Posts : 12,191
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #82

    Well, I have sort of got this working [needs to be right-click and Run as Administrator] . . .

    Code:
    @echo off
    cd /d "C:\Users\System-Admin\System-Admin_Implementation"
    For %%i In (*.bat) Do (
    echo Processing BAT file: "%%i".
    Call "%%i" & echo. & Pause & echo.)
    I can't get it to say Processing completed! at the end for some reason, it just exits!
    Last edited by Paul Black; 18 Mar 2020 at 05:55.
      My Computer

  3. Matthew Wai's Avatar
    Posts : 5,072
    Windows 10 Home 20H2
       #83

    Paul Black said:
    [needs to be right-click and Run as Administrator] . .
    Just double-click on the following CMD script file, which will automatically get administrative privileges.
    Code:
    @echo off
    (Net session >nul 2>&1)||(PowerShell start -verb runas '%~0' &exit /b)
    For %%i In ("E:\Testing\*.bat") Do (echo Processing "%%i"&CMD /C "%%i")
    echo Operations completed. & pause
    It will display "Operations completed" in the end of the process. An error message will appear and the process will be paused as long as an error has arisen. The following code in a batch file will cause such an error.
    Code:
    @echo off
    Start "" "C:\filename.txt"
    Try it yourself. See for yourself.
      My Computer

  4. Paul Black's Avatar
    Posts : 12,191
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #84

    Thanks @Matthew Wai,

    I see what you mean . . .
    Adapting .REG Files.-image.png
    It didn't however stop when all the .bat files had finished, it just exit!
      My Computer

  5. Matthew Wai's Avatar
    Posts : 5,072
    Windows 10 Home 20H2
       #85

    Paul Black said:
    It didn't however stop when all the .bat files had finished, it just exit!
    Sorry for my poor English comprehension. What do the two pronouns "It" and "it" refer to?
      My Computer

  6. Paul Black's Avatar
    Posts : 12,191
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #86

    Hello @Matthew Wai,

    Matthew Wai said:
    Sorry for my poor English comprehension. What do the two pronouns "It" and "it" refer to?
    In the two instances in my post above . . .

    The first It means "The Program / Code", it is capitalised because it is at the beginning of a sentence.
    The second it means the same as the one above but is not capitalised because it is not the beginning of a sentence.

    It basically refers to an object or thing!
      My Computer

  7. Matthew Wai's Avatar
    Posts : 5,072
    Windows 10 Home 20H2
       #87

    Paul Black said:
    It didn't however stop when all the .bat files had finished, it just exit!
    Do you mean the code did not stop running even when all the .bat files had been processed?
    The code will still exist in the script file but will not keep running when all the .bat files have already been processed.
    When you see "Press any key to continue", just press a key, and the Command Prompt window will be closed.
      My Computer

  8. Paul Black's Avatar
    Posts : 12,191
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #88

    Matthew Wai said:
    Do you mean the code did not stop running even when all the .bat files had been processed?
    The code will still exist in the script file but will not keep running when all the .bat files have already been processed.
    When you see "Press any key to continue", just press a key, and the Command Prompt window will be closed.
    Sorry, I didn't explain myself very well.
    When the program finishes running it does not pause it just exits so I can't see what has happened!

    Thanks in advance.
      My Computer

  9. Matthew Wai's Avatar
    Posts : 5,072
    Windows 10 Home 20H2
       #89

    Paul Black said:
    Sorry, I didn't explain myself very well.
    Sorry, I misread "exit" as "exist", so I did not get your point.
    The following is the CMD script, in which the last command is pause.
    Code:
    @echo off
    (Net session >nul 2>&1)||(PowerShell start -verb runas '%~0' &exit /b)
    For %%i In ("E:\Testing\*.bat") Do (echo Processing "%%i"&CMD /C "%%i")
    echo Operations completed. & pause
    The following are the output:
    Adapting .REG Files.-1.jpg

    When I click on "OK", it will go on to the next batch file and then display "Operations completed".

    Adapting .REG Files.-2.jpg

    Paul Black said:
    When the program finishes running it does not pause it just exits so I can't see what has happened!
    Have you used the command pause at the end of your script?

    Paul Black said:
    Code:
    @echo off
    cd /d "C:\Users\System-Admin\System-Admin_Implementation"
    For %%i In (*.bat) Do (
    echo Processing BAT file: "%%i".
    Call "%%i" & echo. & Pause & echo.)
    You have to put & Pause outside the brackets.
      My Computer

  10. Paul Black's Avatar
    Posts : 12,191
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #90

    Hello @Matthew Wai,

    This is the .cmd which I am using which you posted earlier [except I changed the path to my path] . . .

    Code:
    @echo off
    (Net session >nul 2>&1)||(PowerShell start -verb runas '%~0' &exit /b)
    For %%i In ("C:\Users\System-Admin\System-Admin_Implementation\*.bat") Do (echo Processing "%%i"&CMD /C "%%i")
    echo Operations completed. & pause

    It gives me the ERROR message after the script has finished, but it DOESN'T Pause when it has finished!
      My Computer


 
Page 9 of 13 FirstFirst ... 7891011 ... LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 19:37.
Find Us




Windows 10 Forums