|
Answer» I made this batch file about a year ago to fix windows network scanning errors for a program CALLED Spiceworks. Somehow since then I forgot why some of the lines of code are the way that they are, and I think that I have most of the problems fixed now.. but I was hoping that someone could look at the file and see if there are any errors that need fixed.
One thing that I could never figure out was how to get the REGISTRY backup part to just backup to a folder called c:\reg_backup%date% instead of the random number thing that it is currently using.. any help here would be great. (A lot of the users want this fixed so that it backs up to a folder with a date) just figured this out, and changed the batch file.. and tested
I spent a lot of time figuring out what commands would work correctly under XP/Vista/7 so I think everything is OK, but for some reason the copy that was posted had a ton of "\\" when it should just have been "\" but I think that's all fixed now..
It would also be nice if it created a log file.. I tried to add one a long time ago, but couldn't get it to work right
Code: [Select]@ECHO OFF COLOR 1F CD \\ CLS ECHO Version 1.7 ECHO 03/24/2012 ECHO Author: Adam1818 ECHO This has only been tested on Windows 7 and XP ECHO please do your own testing for Vista ECHO . ECHO USE AT YOUR OWN RISK ECHO ************************************************************** ECHO **************************************************************
:ROOT ECHO 1. Please backup my Registry before making any changes ECHO 2. BASIC REBUILD (recommended first attempt) ECHO 3. Advanced Options ECHO 4. Quit Now ECHO 9. COMPLETE REBUILD, without Prompts SET INPUT= SET /p INPUT=Please make a selection... IF "%INPUT%"=="1" GOTO REG_BACKUP IF "%INPUT%"=="2" GOTO FIREWALL_DOM_SER IF "%INPUT%"=="3" GOTO ROOT2 IF "%INPUT%"=="4" GOTO END IF "%INPUT%"=="9" GOTO SKIP FOR %%j IN (1 2 3 4 9) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS GOTO root
:ROOT2 CLS ECHO ADVANCED OPTIONS: make a selection ECHO . ECHO 1. Run NSLOOKUP ECHO 2. Disable System Standby and Hibernate ECHO 3. Rebuild WMI ECHO 4. Delete old Windows updates Temp files ECHO 5. ADD LocalAccountTokenFilterPolicy ECHO 6. Disable UAC ECHO 7. Add LOCAL Administrator account ECHO 8. (BASIC REBUILD) FIREWALL RULES, ENABLE DOM, ADD SERVICES ECHO 9. Registry backup ECHO 10. Windows XP HOME (Not Pro) computer in a workgroup ECHO 11. Restart Computer SET INPUT= SET /p INPUT=Please make a selection... IF "%INPUT%"=="1" GOTO NSLOOKUP IF "%INPUT%"=="2" GOTO PWR_SETTINGS IF "%INPUT%"=="3" GOTO WMI IF "%INPUT%"=="4" GOTO WINUPDATE IF "%INPUT%"=="5" GOTO LATFP IF "%INPUT%"=="6" GOTO UAC IF "%INPUT%"=="7" GOTO ADMIN IF "%INPUT%"=="8" GOTO FIREWALL_DOM_SER IF "%INPUT%"=="9" GOTO REG_BACKUP IF "%INPUT%"=="10" GOTO WIN_XP_WORKGROUP_FIX IF "%INPUT%"=="11" GOTO RESTART_PROMPT FOR %%j IN (1 2 3 4 5 6 7 8 9 10 11) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS GOTO root2
:SKIP CLS ECHO ************************************************************** ECHO ************************************************************** ECHO COMPLETE REBUILD, with no Prompts ECHO This will run the following with NO PROMPTS!! ECHO (This may take 2-15 minutes depending on computer) ECHO ************************************************************** ECHO Complete Registry Backup to c:\REG_BACKUP_MM-DD-YYYY ECHO Disable "Hibernate" and "System Standby" ECHO ADD LocalAccountTokenFilterPolicy ECHO Complete WMI Rebuild ECHO Force Group Policy Updates ECHO Flush DNS (Ipconfig/flushDNS) ECHO Open the correct Firewall ports ECHO Allow ICMP ECHO Request (ping) ECHO Enable Printer and File Sharing (Firewall) ECHO Enable WMI (Firewall) ECHO Enable RDP (Firewall) ECHO Enable DCOM ECHO SET DCOM Authentication Level ECHO SET DCOM Impersonation Level ECHO Change several services to auto start with Windows ECHO ************************************************************** ECHO ************************************************************** ECHO IT DOES NOT DO THE FOLLOWING ECHO ************************************************************** ECHO Delete Windows updates temporary files ECHO Disable UAC ECHO Create an Administrator Account ECHO Run NSLOOKUP tool to test DNS ECHO Disable force guest on Windows XP HOME clients ECHO ************************************************************** ECHO ************************************************************** ECHO Do you want to continue with the COMPLETE REBUILD? ECHO 1. Return to root menu ECHO 9. RUN COMPLETE REBUILD SET SKIP= SET /p SKIP=Please make a selection... (1 or 9) IF "%SKIP%"=="1" GOTO ROOT IF "%SKIP%"=="9" GOTO SKIP2 FOR %%j IN (1 9) DO IF "%%j"=="%SKIP%" GOTO :%SKIP% CLS GOTO SKIP
:REG_BACKUP :SKIP2 SET INPUT=_%date:~4,2%-%date:~7,2%-%date:~10,4% md c:\REG_BACKUP%INPUT% ECHO making a complete backup of the registry at c:\REG_BACKUP%INPUT% REGEDIT.EXE /e c:\REG_BACKUP%INPUT%\complete.reg ECHO making a backup of individual registry keys that will be modified REG export HKLM\SOFTWARE\Microsoft\Ole c:\REG_BACKUP%INPUT%\Ole.REG REG export HKLM\SYSTEM\CurrentControlSET\Services\eventsystem c:\REG_BACKUP%INPUT%\eventsystem.REG REG export HKLM\SYSTEM\CurrentControlSET\Services\lanmanworkstation c:\REG_BACKUP%INPUT%\lanmanworkstation.reg REG export HKLM\SYSTEM\CurrentControlSET\Services\rasauto c:\REG_BACKUP%INPUT%\rasauto.reg REG export HKLM\SYSTEM\CurrentControlSET\Services\remoteregistry c:\REG_BACKUP%INPUT%\remoteregistry.reg REG export HKLM\SYSTEM\CurrentControlSET\Services\rpclocator c:\REG_BACKUP%INPUT%\rpclocator.reg REG export HKLM\SYSTEM\CurrentControlSET\Services\winmgmt c:\REG_BACKUP%INPUT%\winmgmt.reg REG export HKLM\SYSTEM\CurrentControlSET\Services\wmiapsrv c:\REG_BACKUP%INPUT%\wmiapsrv.reg ECHO ************************************************************** ECHO Registry backed up to c:\REG_BACKUP%INPUT% ECHO ************************************************************** IF "%SKIP%"=="9" GOTO SKIP3 GOTO ROOT
:NSLOOKUP CLS ECHO NSLOOKUP This is a basic DNS test SET INPUT= SET /p INPUT=Enter the name of your Spiceworks server: ECHO ************************************************************** NSLOOKUP "%INPUT%" ECHO ************************************************************** ECHO The above results should look similar to the following ECHO ************************************************************** ECHO Server: DNS_servername.DomainName ECHO Address IP address of DNS server ECHO . ECHO Name: Spiceworks_Servername.DomainNmae ECHO Address: IP address of Spiceworks server ECHO ************************************************************** ECHO IF your results don't look the same as the example ECHO your DNS needs to be looked at before running any additional ECHO repairs on the local computer ECHO . ECHO . ECHO 1. Run NSLOOKUP again ECHO 2. Return to Advanced Menu ECHO 3. My DNS is reporting bad information SET INPUT= SET /p INPUT=Please make a selection... IF "%INPUT%"=="1" GOTO NSLOOKUP IF "%INPUT%"=="2" GOTO ROOT2 IF "%INPUT%"=="3" GOTO DNS FOR %%j IN (1 2 3) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS GOTO NSLOOKUP
:DNS ECHO IF you ran NSLOOKUP and it didn't return the anticipated ECHO results.. Does your network even have a DNS server? ECHO Does your DNS have a "reverse lookup zone"? ECHO Is there an "Host (A)" Record for the name you tested? ECHO Watch the video at the following address, it helped me out: ECHO http://www.spiceworks.com/tv/?cat=webinars&video=Managing-DNS ECHO 1. Open the webpage now. ECHO 2. Return to Advance Menu SET INPUT= SET /p INPUT=Please make a selection... IF "%INPUT%"=="1" GOTO DNS_Video IF "%INPUT%"=="2" GOTO ROOT2 FOR %%j IN (1 2) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS GOTO DNS
:DNS_Video Start iexplore "www.spiceworks.com/tv/?cat=webinars&video=Managing-DNS"
:PWR_SETTINGS CLS ECHO Is the computer that you are having problems with ECHO sometimes SCAN correctly, and other it has scan errors? ECHO It may also have duplicates in Spiceworks ECHO if so it maybe the Power Management Settings are set to "hibernate" ECHO or "System Standby" after X amount of time. ECHO if one of the above is true disabling them on this computer may fix your problem ECHO (Disables Hibernation and System Standby ECHO . ECHO 1. Disable Hibernation and System Standby ECHO 2. Return to Advanced Menu. SET INPUT= SET /p INPUT=Please make a selection... IF "%INPUT%"=="1" GOTO VER_PWR IF "%INPUT%"=="2" GOTO ROOT2 FOR %%j IN (1 2) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS
:VER_PWR :SKIP3 ECHO Disable Hibernate and System Standby VER | FINDSTR /IL "5.1." > NUL IF %ERRORLEVEL% EQU 0 GOTO PWR_XP VER | FINDSTR /IL "6.1." > NUL IF %ERRORLEVEL% EQU 0 GOTO PWR_Vista_7 VER | FINDSTR /IL "6.0." > NUL IF %ERRORLEVEL% EQU 0 GOTO PWR_Vista_7 GOTO PWR_SETTINGS
:PWR_XP POWERCFG /hibernate off POWERCFG /CREATE Spice1 POWERCFG /CHANGE Spice1 /monitor-timeout-ac 15 POWERCFG /CHANGE Spice1 /monitor-timeout-dc 10 POWERCFG /CHANGE Spice1 /disk-timeout-ac 30 POWERCFG /CHANGE Spice1 /disk-timeout-dc 10 POWERCFG /CHANGE Spice1 /standby-timeout-ac 0 POWERCFG /CHANGE Spice1 /standby-timeout-dc 0 POWERCFG /CHANGE Spice1 /hibernate-timeout-ac 0 POWERCFG /CHANGE Spice1 /hibernate-timeout-dc 0 POWERCFG /CHANGE Spice1 /processor-throttle-ac ADAPTIVE POWERCFG /CHANGE Spice1 /processor-throttle-dc ADAPTIVE POWERCFG /SETACTIVE Spice1 IF "%SKIP%"=="9" GOTO SKIP4 GOTO ROOT2
:PWR_VISTA_7 powercfg -H off powercfg -x -standby-timeout-ac 0 IF "%SKIP%"=="9" GOTO SKIP4 GOTO ROOT2
:WMI CLS ECHO WMI Rebuild ECHO 1. Rebuild WMI ECHO 2. Return To Advanced Menu SET INPUT= SET /p INPUT=Please make a selection... IF "%INPUT%"=="1" GOTO WMI2 IF "%INPUT%"=="2" GOTO ROOT2 FOR %%j IN (1 2) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS GOTO WMI
:WMI2 :SKIP4 ECHO Rebuilding WMI... Please wait. @echo on cd %WinDir%\System32\Wbem\ net stop sharedaccess net stop winmgmt /y if exist Rep_bak rd Rep_bak /s /q ren Repository Rep_bak for %%i in (*.dll) do RegSvr32 -s %%i @ECHO OFF echo ************************************************** ECHO THE NEXT LINE MAY TAKE A FEW MINUTES, PLEASE WAIT ECHO IGNORE ALL "#PRAGMA AUTORECOVERY" MESSAGES ECHO THAT IS EXPECTED, IT IS NOT AN ERROR echo ************************************************** @ECHO ON for %%i in (*.mof,*.mfl) do Mofcomp %%i net start winmgmt if not exist wmicore.exe goto notexist wmicore /s :notexist @ECHO OFF VER | FINDSTR /IL "5.1." > NUL IF %ERRORLEVEL% EQU 0 GOTO WMI_XP VER | FINDSTR /IL "6.1." > NUL IF %ERRORLEVEL% EQU 0 GOTO WMI_Vista_7 VER | FINDSTR /IL "6.0." > NUL IF %ERRORLEVEL% EQU 0 GOTO WMI_Vista_7 :WMI_XP @ECHO OFF ECHO Windows XP net start winmgmt IF "%SKIP%"=="9" GOTO SKIP5 GOTO ROOT2 :WMI_Vista_7 @ECHO OFF ECHO Windows Vista or 7 ECHO now verifing the WMI Repository winmgmt /resetRepository ECHO THIS WILL TAKE 30 SECONDS winmgmt /verifyrepository net start winmgmt IF "%SKIP%"=="9" GOTO SKIP5 GOTO ROOT2
:WinUpDate CLS ECHO Remove old Windows update temporary files? ECHO (not necessary for Spiceworks scan errors) ECHO 1. Please cleanup the old windows updates temp files ECHO 2. Return to Advanced Menu SET INPUT= SET /p INPUT=Please make a selection... IF "%INPUT%"=="1" GOTO WinUpDate2 IF "%INPUT%"=="2" GOTO ROOT2 FOR %%j IN (1 2) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS GOTO WinUpDate
:WinUpDate2 ECHO Resetting Automatic Updates net stop "Automatic Updates" del /f /s /q %windir%\SoftwareDistribution\*.* ECHO. ECHO. net start "Automatic Updates" ECHO Forcing AU detection and resetting authorization tokens wuauclt.exe /reSETauthorization /detectnow GOTO ROOT2
:LATFP CLS ECHO Some people report that the following key is needed ECHO HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] ECHO "LocalAccountTokenFilterPolicy"=dword:00000001 ECHO . ECHO 1. Please add the Registry key for me ECHO 2. Return to Advanced Menu SET INPUT= SET /p INPUT=Please make a selection... IF "%INPUT%"=="1" GOTO LATFPY IF "%INPUT%"=="2" GOTO ROOT2 FOR %%j IN (1 2) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS GOTO LATFP
:LATFPY :SKIP5 REG add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d "0" /f IF "%SKIP%"=="9" GOTO SKIP6 GOTO :ROOT2
:UAC CLS VER | FINDSTR /IL "5.1." > NUL IF %ERRORLEVEL% EQU 0 GOTO VER ECHO 1. Disable UAC (Recommended for computers not in a Domain) ECHO 2. Return to Advanced Menu SET INPUT= SET /p INPUT= IF "%INPUT%"=="1" GOTO UAC2 IF "%INPUT%"=="2" GOTO ROOT2 FOR %%j IN (1 2) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS GOTO UAC
:UAC2 ECHO Disable UAC REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f GOTO ROOT2
:ADMIN CLS REM List of current Administrator accounts on this computer NET LOCALGROUP Administrators ECHO ************************************************************** ECHO Would you like to add a LOCAL Administrator account? ECHO ************************************************************** ECHO User: SysAdmin ECHO Password: Passw0rd (P is capital, and 0 is a zero) ECHO ************************************************************** ECHO 1. please add the account for me. ECHO 2. Return to Advanced Menu SET INPUT= SET /p INPUT=Please make a selection... IF "%INPUT%"=="1" GOTO AddAccount IF "%INPUT%"=="2" GOTO ROOT2 FOR %%j IN (1 2) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS GOTO ADMIN
:AddAccount net user SysAdmin Passw0rd /ADD net localgroup Administrators SysAdmin /ADD ECHO: Administrator account has been added GOTO ROOT2
:FIREWALL_DOM_SER :SKIP6 ECHO refreshing system policies ECHO IF it hangs here for more than a few minutes ECHO Press N and then enter, and the script should cont. gpupdate /force ipconfig /flushdns VER | FINDSTR /IL "5.1." > NUL IF %ERRORLEVEL% EQU 0 GOTO ver_xp VER | FINDSTR /IL "6.1." > NUL IF %ERRORLEVEL% EQU 0 GOTO ver_7 VER | FINDSTR /IL "6.0." > NUL IF %ERRORLEVEL% EQU 0 GOTO ver_vista
:ver_xp ECHO Windows XP commands ECHO Setting Firewall Services netsh firewall SET icmpSETting 8 netsh firewall SET service remoteadmin enable netsh firewall SET service remoteadmin enable subnet GOTO DCOM
:ver_vista ECHO Vista commands ECHO SETting Firewall Services netsh firewall SET icmpSETting 8 enable netsh firewall SET service remoteadmin enable netsh firewall SET service remoteadmin enable subnet netsh advfirewall firewall SET rule group="file and printer sharing" new enable=yes netsh advfirewall firewall SET rule group="windows management instrumentation (wmi)" new enable=yes netsh advfirewall firewall SET rule group="remote administration" new enable=yes GOTO DCOM
:ver_7 ECHO Windows 7 commands ECHO Setting Firewall Services netsh advfirewall firewall SET rule group="file and printer sharing" new enable=yes netsh advfirewall firewall SET rule group="windows management instrumentation (wmi)" new enable=yes REM following line will error on Win 7 Home Edition netsh advfirewall firewall SET rule group="remote administration" new enable=yes GOTO DCOM
:DCOM ECHO Enabling DCOM REG add HKLM\SOFTWARE\Microsoft\Ole /v EnableDCOM /t REG_SZ /d "Y" /f ECHO Configuring DCOM REG add HKLM\SOFTWARE\Microsoft\Ole /v LegacyAuthenticationLevel /t REG_DWORD /d "2" /f REG add HKLM\SOFTWARE\Microsoft\Ole /v LegacyImpersonationLevel /t REG_DWORD /d "3" /f GOTO Services
:Services ECHO Changing Service Startup Configurations REG ADD HKLM\SYSTEM\CurrentControlSET\Services\eventsystem /v start /t REG_DWORD /d 2 /f REG ADD HKLM\SYSTEM\CurrentControlSET\Services\lanmanworkstation /v start /t REG_DWORD /d 2 /f REG ADD HKLM\SYSTEM\CurrentControlSET\Services\rasauto /v start /t REG_DWORD /d 2 /f REG ADD HKLM\SYSTEM\CurrentControlSET\Services\remoteregistry /v start /t REG_DWORD /d 2 /f REG ADD HKLM\SYSTEM\CurrentControlSET\Services\rpclocator /v start /t REG_DWORD /d 2 /f REG ADD HKLM\SYSTEM\CurrentControlSET\Services\rpcss /v start /t REG_DWORD /d 2 /f REG ADD HKLM\SYSTEM\CurrentControlSET\Services\winmgmt /v start /t REG_DWORD /d 2 /f REG ADD HKLM\SYSTEM\CurrentControlSET\Services\wmiapsrv /v start /t REG_DWORD /d 2 /f ECHO Resyncing WMI winmgmt.exe /resyncperf GOTO Restart_Prompt
:WIN_XP_WORKGROUP_FIX VER | FINDSTR /IL "5.1." > NUL IF %ERRORLEVEL% EQU 0 GOTO ver_xp_WGFIX VER | FINDSTR /IL "6.1." > NUL IF %ERRORLEVEL% EQU 0 GOTO ROOT2 VER | FINDSTR /IL "6.0." > NUL IF %ERRORLEVEL% EQU 0 GOTO ROOT2 :ver_xp_WGFIX CLS ECHO Note that for Windows XP in a workgroup setting, ECHO default all connections coming from "the network" ECHO will be authenticated as the Guest User. ECHO ************************************************************** ECHO Note that for WinXP Home you cannot disable ECHO the ForceGuest behavior (only in WinXP Pro). ECHO ************************************************************** ECHO However this will make the change in the Registry ECHO to fix the problem in WinXP Home Computers. ECHO ************************************************************** ECHO This will change the registry key for you. ECHO ************************************************************** ECHO 1. please change the registry value for me. ECHO 2. Return to Advanced Menu SET INPUT= SET /p INPUT=Please make a selection... IF "%INPUT%"=="1" GOTO WGFIX IF "%INPUT%"=="2" GOTO ROOT2 FOR %%j IN (1 2) DO IF "%%j"=="%INPUT%" GOTO : :WGFIX REG add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v ForceGuest /t REG_DWORD /d "0" /f GOTO ROOT2
:Restart_Prompt CLS ECHO ************************************************************** ECHO ************************************************************** ECHO Some changes will not take effect until you restart. ECHO Would you like to restart your computer now? ECHO ************************************************************** ECHO ************************************************************** ECHO 1. Restart my computer in 15 seconds ECHO 2. I will restart it myself SET INPUT= SET /p INPUT= IF "%INPUT%"=="1" GOTO RESTART IF "%INPUT%"=="2" GOTO END FOR %%j IN (1 2) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS GOTO Restart_Prompt
:RESTART shutdown /r /t 15 /c "your computer will restart in 15 seconds" exit
:END exit Qlueless, Welcome to the CH forum. I can not personally help you. May I offer some suggestions? First, never expect volunteers to verify a long, long batch file.
Second, you need to make it cleaner for yourself. You can not remember a year later what you did. Maybe your code is much too long for yourself to visualize easily. . You need to BREAK it up into short things the can e tested and verified. These are called subroutines and can be other batch files. You invoke such with the CALL keyword and pass arguments. Much easier to understand.
You need to make more comments about what things do and why you do something odd or different that what would be expected. And you need to implement some kind of error recovery method.
Also, you short write a paragraph or two about why you are doing this. Is it just and exercise? or does it fill a need that can not be done some other way? Do you every use VB Script? Some very good points by Geek:
Quote never expect volunteers to verify a long, long batch file This most of all. You see this type of question from time to time, and often nobody at all replies.
Quoteyou need to make it cleaner for yourself. You can not remember a year later what you did. Maybe your code is much too long for yourself to visualize easily. . You need to break it up into short things the can e tested and verified. These are called subroutines and can be other batch files. You invoke such with the CALL keyword and pass arguments. Much easier to understand. This is definitely good advice. Start small and work your way up. Write and test the script in stages. Make sure each part works before adding another.
QuoteYou need to make more comments about what things do Failing to COMMENT is one of the biggest mistakes that a batch scripter can make, in my opinion. Not only does good commenting help when you come back later on, it can help you right now, as you are actually writing the code, because it forces you to state in writing what a line or section of code is supposed to do. In order to do this, you have to actually think about that. If you just slap lines of code in because you hope they might do what you want, you'll end up with a mess, and you won't know what works and what doesn't (and why). Sometimes you need to turn echoing on to see where code is not doing what you want. For example here the code I show in red does absolutely nothing and if you put @echo on before it and @echo off after it, you will see why.
SET INPUT= SET /p INPUT= IF "%INPUT%"=="1" GOTO RESTART IF "%INPUT%"=="2" GOTO END FOR %%j IN (1 2) DO IF "%%j"=="%INPUT%" GOTO :%INPUT% CLS GOTO Restart_Prompt
It looks like it was left over from an earlier incarnation of the script where you made the code GOTO a variable label e.g. :1 :2 etc and then you found out that typing 3 made the script crash?
well you could always run the program and see where it crashes, here's a script that will make a copy that creates a log of the commands that it does before it crashes, that way if it does have an error, you will know exactly which line it is on. Code: [Select] @echo off echo Enter Name Of File To Edit set /p name= echo @echo off >>%name%Bug.bat echo ^:^: This is a bug testing program for batch. >>%name%Bug.bat echo ^:^: Results may varry with scrips containing for loops. >>%name%Bug.bat echo ^:^: ******* By Lemonilla >>%name%Bug.bat for /f "delims=" %%G in (%name%.bat) do ( echo echo %%G ^>^>%name%Log.txt >>%name%Bug.bat echo %%G ^>^>%name%Log.txt >>%name%Bug.bat echo %%G >>%name%Bug.bat ) start %name%Bug.bat
PS: Don't know if this works with multi-line for loops.
|