Windows 10: Create Multipurpose batch file

Discus and support Create Multipurpose batch file in Windows 10 Software and Apps to solve the problem; Hope this is the correct sub forum for this.. Often use a variety of command line functions e.g. winver / netplwiz etc etc Is there a way of... Discussion in 'Windows 10 Software and Apps' started by reddwarf4ever, Sep 23, 2016.

  1. Create Multipurpose batch file


    Hope this is the correct sub forum for this..

    Often use a variety of command line functions e.g. winver / netplwiz etc etc

    Is there a way of creating a batchfile to include multiple commands with a number option to select...would be so handy

    i.e. 1 Netplwiz
    2 Winver
    3 ???
    Thanks

    :)
     
    reddwarf4ever, Sep 23, 2016
    #1
  2. jmhar0520 Win User

    Is it possible to add a custom image to pop ups created with a batch file.

    I have a question about custom pop ups created with a batch file. I want to know if it is possible to add a custom image to pop ups created with a batch file?

    Original Title: batch files
     
    jmhar0520, Sep 23, 2016
    #2
  3. lacrumb Win User
    Something is creating batch files

    Have you run Windows Defender and Malwarebytes?
     
    lacrumb, Sep 23, 2016
    #3
  4. cereberus Win User

    Create Multipurpose batch file

    Sure it is possible with command line arguments.

    Batch Files - Create a Menu to Execute Commands - Windows 7 Help Forums
     
    cereberus, Sep 23, 2016
    #4
  5. Thanks so much, that is exactly what need, just need a resource for handy command line arguments...

    PS is there a third party program that would do this
     
    reddwarf4ever, Sep 23, 2016
    #5
  6. I have created a batch file for winver and netplwiz, but when i try ipconfig or sfc /scannow they require admin rights....what can i add to run these without entering my password every time....
    Thanks
     
    reddwarf4ever, Sep 24, 2016
    #6
  7. Have done so more work on a batchfile...Have created a shortcut to it and given this admin rights, but still some commands seem to need something else..

    a little help please

     
    reddwarf4ever, Sep 24, 2016
    #7
  8. Michael Win User

    Create Multipurpose batch file

    I was just looking into making something like this a few weeks ago, and decided to go with an AutoIt GUI.

    Here's an example you could use (+ a gif):


    Create Multipurpose batch file [​IMG]


    Code: #NoTrayIcon #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Add/remove buttons here, adjusting array numbers accordingly Local $btn[3] $btn[0] = 'Example Cmd' $btn[1] = 'Another One' $btn[2] = 'One More' ; Make sure func names match button text, minus spaces Func ExampleCmd() Run('rundll32 netplwiz.dll,UsersRunDll') EndFunc Func AnotherOne() Run('winver') EndFunc Func OneMore() Run('cmd /k ipconfig') EndFunc ; GUI dimensions/positions Local $btnCount = UBound($btn) Local $btnWidth = 155 Local $btnHeight = 55 Local $btnPad = 6 Local $btnX = $btnPad * 1.2 Local $btnY[$btnCount] $btnY[0] = $btnPad * 1.8 For $i = 1 To $btnCount - 1 $btnY[$i] = $btnY[$i - 1] + $btnHeight + $btnPad Next Local $winWidth = $btnWidth + $btnX * 2 local $winHeight = ($btnHeight + $btnPad) * $btnCount + $btnPad * 2.4 Local $winX = 0 Local $winY = @desktopHeight - 41 - $winHeight ; GUI Local $win = GUICreate('', $winWidth, $winHeight, $winX, $winY, $WS_POPUP + $WS_BORDER, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) GUISetFont(14, 0, 0, 'Segoe UI') For $i = 0 To $btnCount - 1 GUICtrlCreateButton($btn[$i], $btnX, $btnY[$i], $btnWidth, $btnHeight) GUICtrlSetOnEvent(-1, StringStripWS($btn[$i], 8)) Next Opt('GUIOnEventMode', 1) GUISetState(@SW_SHOW) While 1 If WinActive($win) = 0 Then Exit EndIf Sleep(50) WEnd[/quote] You'll just need to have AutoIt installed, paste that into an .au3, edit the commands, and create a shortcut to it (that icon is in imageres.dll). You also might want to adjust the window X/Y positions to have it pop up adjacent to wherever you keep the shortcut.
     
    Michael, Sep 24, 2016
    #8
  9. Thanks given me something to think about....

    still would like like to know what's wrong with my batch file commands....


    PS where did you get Windows 11 from LOL*chuckle
     
    reddwarf4ever, Sep 24, 2016
    #9
  10. Michael Win User
    Haha, I wish that were the future of Windows. It's just Classic Shell with a few icons I found various places (they're here in my Google Drive if you want em).

    Sorry to not really answer your question again, but I kinda skipped over the whole batch scripting thing and went straight into PowerShell. Here's what your script might look like in a .ps1:

    Code: function Commands { Clear-Host $Entry = Read-Host @' 1 - Windows Version 2 - User Accounts Login option 3 - Internet protocol configuration 4 - System file checker 5 - Checkdisk 6 - Clean up 7 - Computer Management 8 - System Restore 9 - DirectX diagnostics 0 - EXIT '@ if ($Entry -eq 1) {winver; Commands} elseif ($Entry -eq 2) {netplwiz; Commands} elseif ($Entry -eq 3) {Clear-Host; ipconfig; Pause; Commands} elseif ($Entry -eq 4) {Clear-Host; sfc /scannow; Pause; Commands} elseif ($Entry -eq 5) {Clear-Host; chkdsk; Pause; Commands} elseif ($Entry -eq 6) {cleanmgr; Commands} elseif ($Entry -eq 7) {compmgmt; Commands} elseif ($Entry -eq 8) {wscui; Commands} elseif ($Entry -eq 9) {dxdiag; Commands} elseif ($Entry -eq 0) {Exit} else {Commands} } Commands[/quote]
     
    Michael, Sep 25, 2016
    #10
  11. Thank you.......looks much tidier.....

    Opened a pwershell window, pasted code, but how / do i need to save it, how do i run it

    thanks
     
    reddwarf4ever, Sep 25, 2016
    #11
  12. Michael Win User
    First, you'll have to enable PS script execution on your system. Open PowerShell as admin and enter:
    Code: Set-ExecutionPolicy RemoteSigned[/quote] Now create a .ps1 file and paste the script in.

    To run it, you can right-click to "Run with PowerShell", or if you want to run with a more direct click, the easiest way is to create a shortcut with a target like (and must be single quotes):
    Code: powershell & 'C:\Path\To\Your.ps1'[/quote]
     
    Michael, Sep 25, 2016
    #12
  13. Create Multipurpose batch file

    Thank you ......will try very soon
     
    reddwarf4ever, Apr 5, 2018
    #13
Thema:

Create Multipurpose batch file

Loading...
  1. Create Multipurpose batch file - Similar Threads - Create Multipurpose batch

  2. Creating batch file on Win10

    in Windows 10 Network and Sharing
    Creating batch file on Win10: Hey, this is someone's previous answer of creating a bat file but it only works if you dont change the file name first to "*.bat" before you open the file:Open the fileClick Save AsSelect the desired locationIn the File name field, type Whatever.batIn the Type field, select...
  3. Creating batch file on Win10

    in Windows 10 Gaming
    Creating batch file on Win10: Hey, this is someone's previous answer of creating a bat file but it only works if you dont change the file name first to "*.bat" before you open the file:Open the fileClick Save AsSelect the desired locationIn the File name field, type Whatever.batIn the Type field, select...
  4. Creating batch file on Win10

    in Windows 10 Software and Apps
    Creating batch file on Win10: Hey, this is someone's previous answer of creating a bat file but it only works if you dont change the file name first to "*.bat" before you open the file:Open the fileClick Save AsSelect the desired locationIn the File name field, type Whatever.batIn the Type field, select...
  5. Creating a Batch File Example

    in Windows 10 Support
    Creating a Batch File Example: Hey All, I am not looking for someone to do the work for me, I'm trying to get a general idea of what I need to start at. It's been a few years since I've done a batch file and Windows 10 is so different than Windows 7. I am essentially wanting a batch file, that if I type a...
  6. Creating a batch file to send the label files to the printer

    in Windows 10 Support
    Creating a batch file to send the label files to the printer: is it possible to create a bat file to print a barcode label? 178788
  7. Need help to create a batch file

    in Windows 10 Support
    Need help to create a batch file: Hi Folks, I need to create a batch file that automatically takes permissions & delete the following file & folders File:- C:\Windows\System32\SecurityHealthSystray.exe Folders:-...
  8. How to create a batch file for network printer

    in Windows 10 Drivers and Hardware
    How to create a batch file for network printer: How to create batch file for several network printers? I used the below info, but when I entered several printers only the first one worked. %SystemRoot%\explorer.exe \\ServerName\PrinterName...
  9. Create batch files with Batch?

    in Windows 10 Software and Apps
    Create batch files with Batch?: How to create Batch and VBS files with Batch? So I write a batch file which I then convert to exe that creates new folders in a certain directory and then creates batch and VBS files with a certain content and saves them in the created folder. So it's similar to a program...
  10. Include date in file created by batch file.

    in Windows 10 Support
    Include date in file created by batch file.: How can I add to this batch command to include the date: xcopy C:\all\* Z:\Allbak\* /E /Y /C I'd like the resulting file to be named "Z:\Allbak171129" (yr mo day). The plan is to set up a task schedule to run the batch file every week. I want to keep several previous...