├── README.md ├── BattleScript 1.0 ├── Sounds │ ├── Shoot.wav │ ├── Splash.wav │ ├── Explosion.wav │ └── Explosion2.wav ├── LineCount.bat ├── Commands.txt └── BattleScript.bat ├── Launch Old Games ├── #Win7Start# │ └── QRes.exe └── #Win7Start#.bat ├── Startup ├── InvisibleHelper.bat ├── startup.txt ├── Battle.Net Launcher Info.txt ├── Minimize.vbs └── Startup.bat ├── Random Numbers (Animated).bat ├── Timeout User.bat ├── Win10 Tool.bat ├── SymLink Creator.bat ├── Network Interfaces.bat └── Network Shares.bat /README.md: -------------------------------------------------------------------------------- 1 | # Batch-Scripts 2 | A collection of batch scripts I've written over the years. 3 | -------------------------------------------------------------------------------- /BattleScript 1.0/Sounds/Shoot.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corpnewt/Batch-Scripts/HEAD/BattleScript 1.0/Sounds/Shoot.wav -------------------------------------------------------------------------------- /BattleScript 1.0/Sounds/Splash.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corpnewt/Batch-Scripts/HEAD/BattleScript 1.0/Sounds/Splash.wav -------------------------------------------------------------------------------- /BattleScript 1.0/Sounds/Explosion.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corpnewt/Batch-Scripts/HEAD/BattleScript 1.0/Sounds/Explosion.wav -------------------------------------------------------------------------------- /Launch Old Games/#Win7Start#/QRes.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corpnewt/Batch-Scripts/HEAD/Launch Old Games/#Win7Start#/QRes.exe -------------------------------------------------------------------------------- /BattleScript 1.0/Sounds/Explosion2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/corpnewt/Batch-Scripts/HEAD/BattleScript 1.0/Sounds/Explosion2.wav -------------------------------------------------------------------------------- /BattleScript 1.0/LineCount.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal enabledelayedexpansion 3 | 4 | :mainMenu 5 | set /a count=0 6 | cls 7 | for /F "delims=" %%A in (BattleScript.bat) do ( 8 | set /a count+=1 9 | ) 10 | echo !count! Non-Empty Lines. 11 | pause 12 | -------------------------------------------------------------------------------- /Startup/InvisibleHelper.bat: -------------------------------------------------------------------------------- 1 | @set @junk=1 /* 2 | @echo off 3 | 4 | REM This script just launches a batch file invisibly 5 | 6 | */ 7 | 8 | var x = WScript.Arguments; 9 | var name = x(0); 10 | var objShell = new ActiveXObject("WScript.shell"); 11 | objShell.run("\"" + name + "\"",0); -------------------------------------------------------------------------------- /BattleScript 1.0/Commands.txt: -------------------------------------------------------------------------------- 1 | When playing this game, at most prompts you should be able to type these commands and get the desired results: 2 | 3 | sounds on/off turns on/off sounds 4 | animations on/off turns on/off animations 5 | devmode on/off turns on/off dev mode which generates a text file of cpu player output 6 | cheats on/off turns on/off cheats 7 | nowait on/off Disables/Enables wait time during CPU turn 8 | mainmenu takes you back to the main menu 9 | showmethemoney when cheats are on, shows your opponents board 10 | 11 | In the ship placing/shooting menu: 12 | 13 | random randomly places ships/shoots for you -------------------------------------------------------------------------------- /Startup/startup.txt: -------------------------------------------------------------------------------- 1 | ### ### 2 | # Instructions # 3 | ### ### 4 | 5 | # Options are: 6 | # path = path to program to launch 7 | # exec = the executable to check for if only one instance is allowed 8 | # name = the name to display in the script 9 | # args = any arguments (accepts double-quotes) 10 | # mult = y/n allow multiple instances? 11 | # mini = y/n use start with /min ? 12 | # dela = how many extra seconds to wait before launching? 13 | # webs = a web address - this is superceded by the path variable though 14 | # 15 | # Each entry is separated by a semicolon (;) 16 | 17 | ### ### 18 | # Apps to launch # 19 | ### ### 20 | 21 | path=C:\Program Files (x86)\Ubisoft\Ubisoft Game Launcher\Uplay.exe;mini=y 22 | 23 | path=C:\Windows\System32\cscript.exe;name=Uplay Minimizer;args=//nologo "C:\Utilities\Startup\Minimize.vbs" /exe:Uplay.exe /path:"C:\Program Files (x86)\Ubisoft\Ubisoft Game Launcher\Uplay.exe" /launch:false /wait:1500 /menuKey:c;exec=Uplay.exe;mini=n;mult=y;dela=5 24 | 25 | path=C:\Program Files (x86)\Origin\Origin.exe;args=/StartClientMinimized;mini=y 26 | 27 | path=D:\Program Files (x86)\Battle.net\Battle.net Launcher.exe;mini=y;args=--autostarted;exec=Battle.net.exe 28 | 29 | ### ### 30 | # Scripts to launch # 31 | ### ### 32 | 33 | 34 | ### ### 35 | # Finishing Touches # 36 | ### ### 37 | -------------------------------------------------------------------------------- /Startup/Battle.Net Launcher Info.txt: -------------------------------------------------------------------------------- 1 | ### ### 2 | # Battle.Net Launcher Start Minimized # 3 | ### ### 4 | 5 | There are 2 very important things we need to do to get the Battle.net Launcher 6 | to start minimized. This is primarily for use with the Startup.bat script. 7 | 8 | 1. Locate C:\C:\Users\Chip\AppData\Roaming\Battle.net\f3bcd997.config 9 | Yours might be named different - but there should only be 2 .config files, 10 | the settings one (f3bcd997 in my case) and Battle.net.config 11 | 12 | 2. Open it and look for this line: "MinimizedOnStartup": "false" 13 | 14 | 3. If you find that line, change "false" to "true" 15 | If you DIDN'T find that line, we need to add it. The structure of the 16 | .config file is pretty easy. It's almost XML. You can add it here: 17 | 18 | "Client": 19 | { 20 | "MinimizedOnStartup": "true", 21 | "PlayScreen": 22 | { 23 | ... 24 | }, 25 | "Windows": 26 | { 27 | ... 28 | } 29 | } 30 | 31 | Just ensure that you have a comma (",") after each entry except the 32 | last one - or the offending var will be deleted. 33 | 34 | 4. When you launch "Battle.net Launcher.exe", do it like so: 35 | 36 | "Battle.net Launcher.exe" --autostarted 37 | 38 | This convinces the launcher that it was started at login, which in turn 39 | causes it to look for the "MinimizedOnStartup" variable. -------------------------------------------------------------------------------- /Random Numbers (Animated).bat: -------------------------------------------------------------------------------- 1 | @set @junk=1 /* 2 | @echo off 3 | setlocal enableDelayedExpansion 4 | 5 | set thisScript=%0 6 | 7 | set /a min=1 8 | set /a max=10 9 | 10 | :mainMenu 11 | cls 12 | set menu= 13 | echo ### Random Number Generator ### 14 | echo. 15 | echo Current range is !min!-!max! 16 | echo. 17 | echo 1. Pick new min 18 | echo 2. Pick new max 19 | echo. 20 | echo Q. Quit 21 | echo. 22 | echo Press ^[enter^] to generate with current settings 23 | echo. 24 | set /p menu="What would you like to do? " 25 | 26 | if !menu!==1 goto pickMin 27 | if !menu!==2 goto pickMax 28 | if !menu!==q goto quit 29 | if !menu!==Q goto quit 30 | if "!menu!"=="" goto generate 31 | goto mainMenu 32 | 33 | :pickMin 34 | cls 35 | set /a newMin=!min! 36 | echo ### Pick New Min ### 37 | echo. 38 | echo. 39 | set /p newMin="Please enter the new min value: " 40 | if "!newMin!"=="" goto mainMenu 41 | set /a min=!newMin! 42 | if !min! GTR !max! set /a max=!min! 43 | goto mainMenu 44 | 45 | :pickMax 46 | cls 47 | set /a newMax=!max! 48 | echo ### Pick New Max ### 49 | echo. 50 | echo. 51 | set /p newMax="Please enter the new max value: " 52 | if "!newMax!"=="" goto mainMenu 53 | set /a max=!newMax! 54 | if !max! LSS !min! set /a min=!max! 55 | goto mainMenu 56 | 57 | :generate 58 | call :animate 59 | 60 | cls 61 | 62 | set menu= 63 | echo ### Random number from !min!-!max! ### 64 | echo. 65 | echo. 66 | set /a rand=!RANDOM! * (!max!-(!min!-1)) / 32768 + !min! 67 | echo Your number is: !rand! 68 | echo. 69 | echo. 70 | echo M. Main Menu 71 | echo. 72 | echo Press ^[enter^] to generate another number 73 | echo. 74 | set /p menu="What would you like to do? " 75 | 76 | if !menu!==m goto mainMenu 77 | if !menu!==M goto mainMenu 78 | 79 | goto generate 80 | 81 | :animate 82 | set frame="|" 83 | call :displayAnimation "!min! | !max!" 84 | call :displayAnimation "!min! / !max!" 85 | call :displayAnimation "!min! - !max!" 86 | call :displayAnimation "!min! \ !max!" 87 | call :displayAnimation "!min! | !max!" 88 | call :displayAnimation "!min! / !max!" 89 | call :displayAnimation "!min! - !max!" 90 | call :displayAnimation "!min! \ !max!" 91 | call :displayAnimation "!min! | !max!" 92 | call :displayAnimation "!min! / !max!" 93 | call :displayAnimation "!min! - !max!" 94 | call :displayAnimation "!min! \ !max!" 95 | call :displayAnimation "!min! | !max!" 96 | call :displayAnimation "!min! / !max!" 97 | call :displayAnimation "!min! - !max!" 98 | call :displayAnimation "!min! \ !max!" 99 | call :displayAnimation "!min! | !max!" 100 | call :displayAnimation "!min! / !max!" 101 | call :displayAnimation "!min! - !max!" 102 | call :displayAnimation "!min! \ !max!" 103 | call :displayAnimation "!min! | !max!" 104 | goto :EOF 105 | 106 | 107 | :displayAnimation anim 108 | set "animation=%~1" 109 | cls 110 | if NOT "!animation!"=="" ( 111 | echo ########################## 112 | echo ### Generating ### 113 | echo ########################## 114 | echo. 115 | echo !animation! 116 | cscript //nologo //E:jscript !thisScript! %* "25" 117 | REM pause 118 | ) 119 | goto :EOF 120 | 121 | :quit 122 | exit /b 123 | 124 | :: Java */ 125 | var x = WScript.Arguments; 126 | var sleepTime = x(1); 127 | //WScript.echo(sleepTime) 128 | WScript.Sleep( sleepTime ); -------------------------------------------------------------------------------- /Startup/Minimize.vbs: -------------------------------------------------------------------------------- 1 | 'Let's get our command line arguments 2 | 'Available options are /exe, /path, /wait, /launch, /menuKey 3 | 4 | 'EXAMPLE: 5 | 6 | 'cscript.exe Minimize.vbs /exe:Uplay.exe 7 | '/path:"C:\Program Files (x86)\Ubisoft\Ubisoft Game Launcher\Uplay.exe" 8 | '/wait:1000 /launch:true /menuKey:c 9 | 10 | 'This would all be run on one line - and would launch Uplay.exe, wait 11 | 'for /wait milliseconds (1000) - then minimize it. The launch option 12 | 'means we will launch from the path - it HAS to be "true" if we want it 13 | 'to work - everything else will be false 14 | 15 | set objArgs = WScript.Arguments.Named 16 | 17 | exe = "" 18 | path = "" 19 | wait = 1000 20 | launch = "false" 21 | menuKey = "n" 22 | 23 | If NOT(objArgs.Exists("exe")) Then 24 | WScript.Quit 1 25 | Else 26 | exe = objArgs.Item("exe") 27 | End If 28 | 29 | if objArgs.Exists("launch") Then 30 | if StrComp(objArgs.Item("launch"), "true", vbTextCompare) = 0 Then 31 | launch = "true" 32 | WScript.Echo(exe & " launch? - " & launch) 33 | else 34 | launch = "false" 35 | WScript.Echo(exe & " launch? - " & launch) 36 | end if 37 | end if 38 | 39 | If objArgs.Exists("path") Then 40 | path = objArgs.Item("path") 41 | Else 42 | launch = "false" 43 | End If 44 | 45 | If objArgs.Exists("menuKey") Then 46 | menuKey = objArgs.Item("menuKey") 47 | End If 48 | 49 | if objArgs.Exists("wait") Then 50 | wait = objArgs.Item("wait") 51 | end if 52 | 53 | set oShell = CreateObject("WScript.Shell") 54 | 55 | 'Now we see if we should launch 56 | if StrComp(launch, "true", vbTextCompare) = 0 then 57 | set appLaunch = oShell.Exec(path) 58 | end if 59 | 60 | dim pidAr 61 | pidAr = getPIDForName(exe) 62 | 63 | on error resume next 64 | WScript.Echo("There are " & UBound(pidAr)+1 & " instances of " & exe & ".") 65 | if err.number<>0 then 66 | WScript.Echo("An error!!") 67 | 'do x,y,z instead 68 | WScript.Quit 2 69 | end if 70 | on error goto 0 71 | 72 | 73 | 'WScript.Echo(UBound(pidAr)) 74 | 75 | 'WScript.Echo("There are " & UBound(pidAr) & " instances of " & exe & ".") 76 | 77 | for i = 0 to UBound(pidAr) 78 | 79 | oShell.AppActivate pidAr(i) 80 | WScript.Sleep wait 81 | 'WScript.Echo("% (" & menuKey & ")") 82 | 'oShell.SendKeys "% (" & menuKey & ")" ' minimize (Alt+SpaceBar,n) 83 | 'Open menu 84 | oShell.SendKeys "% " 85 | 'Type our menuKey 86 | WScript.Sleep wait 87 | oShell.SendKeys menuKey ' minimize (Alt+SpaceBar,n) 88 | 89 | next 90 | 91 | 92 | Function getPIDForName(processName) 93 | 'Get process ids for the named application 94 | 'returns an array 95 | Dim computer 96 | computer = "." 97 | Dim process 98 | process = exe 99 | Dim pidArray() 100 | Dim arrayIndex 101 | arrayIndex = 0 102 | 103 | Set service = GetObject("winmgmts:\\" & computer & "\root\cimv2") 104 | Set results = service.ExecQuery(" Select * from Win32_Process where Name ='" & process & "'") 105 | for each obj in results 106 | 'Wscript.echo obj.Name 107 | Wscript.echo obj.ProcessID 108 | ReDim Preserve pidArray(arrayIndex) 109 | pidArray(arrayIndex) = obj.ProcessID 110 | arrayIndex = arrayIndex + 1 111 | next 112 | getPIDForName = pidArray 113 | End Function 114 | 115 | 'Firefox = """c:\path to\firefox.exe""" 116 | 'Set oShell = CreateObject("WScript.Shell") 117 | 'Set oFFox = oShell.Exec(Firefox) 118 | 119 | 'WScript.Sleep 1000 120 | 'oShell.AppActivate oFFox.ProcessID 121 | 122 | 'WScript.Sleep 1000 123 | 'oShell.SendKeys "% (n)" ' minimize (Alt+SpaceBar,n) 124 | 125 | 'WScript.Sleep 10 * 1000 ' wait 10 seconds 126 | 'next AppActivate call need Full and Exact title 127 | 'oShell.AppActivate "Mozilla Firefox Start Page - Mozilla Firefox" 128 | 129 | 'WScript.Sleep 1000 130 | 'oShell.SendKeys "% (r)" ' restore (Alt+SpaceBar,r) 131 | 'oShell.SendKeys "%{F4}" ' close (Alt+F4) -------------------------------------------------------------------------------- /Timeout User.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal enabledelayedexpansion 3 | 4 | set name=Chip 5 | 6 | :mainMenu 7 | 8 | cls 9 | 10 | REM This script uses a function to check for user input or set 11 | REM a default based on timeout. 12 | 13 | echo "%TIME%" 14 | echo "%DATE%" 15 | 16 | Echo ### Pause Break Check ### 17 | echo. 18 | echo Press enter to input a name, or 19 | echo wait for the timer to run down to 20 | echo have the name default to %name%. 21 | 22 | set /a hidden=0 23 | 24 | call :userTimeout 10 !hidden! didBreak 25 | 26 | if !didBreak! GTR 0 ( 27 | REM User interrupted. 28 | goto inputName 29 | ) else ( 30 | REM Timeout succeeded. 31 | goto sayHello 32 | ) 33 | 34 | :inputName 35 | set name= 36 | cls 37 | echo ### Pause Break Check ### 38 | echo. 39 | echo You chose to enter your own name. 40 | echo. 41 | set /p "name=Please type a new name: " 42 | if "%name%"=="" goto inputName 43 | goto sayHello 44 | 45 | :sayHello 46 | cls 47 | echo ### Pause Break Check ### 48 | echo. 49 | echo Hello, %name%. It's nice to meet you. 50 | echo. 51 | echo Press [enter] to return to the main menu... 52 | pause > nul 53 | goto mainMenu 54 | 55 | REM ############################################################ 56 | REM ### For use in other scripts copy the text starting here ### 57 | REM ############################################################ 58 | 59 | :userTimeout 60 | REM Let's wait, and see if we waited the full 61 | REM amount, or if the user interrupted. 62 | set waitTime=%~1 63 | call :getTime %TIME% firstTime 64 | call :getJulianDate "%DATE%" firstDate 65 | if %~2 GTR 0 ( 66 | timeout !waitTime! > nul 67 | ) else ( 68 | timeout !waitTime! 69 | ) 70 | call :getTime %TIME% secondTime 71 | call :getJulianDate "%DATE%" secondDate 72 | REM Find out if the days are different and add 73 | REM seconds accordingly. 74 | set /a diff=(!secondTime!-!firstTime!)+(!secondDate!-!firstDate!)*86400 75 | if !diff! LSS !waitTime! ( 76 | set %~3=1 77 | ) else ( 78 | set %~3=0 79 | ) 80 | goto :EOF 81 | 82 | :getTime