Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


ghosttracer

Member
  • Content Count

    5
  • Donations

    $0.00 
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ghosttracer

Profile Information

  • OS
    Windows 8.1 x64
  1. Good day Sorry about the long reply. I was busy debugging etc.. Here is my final (hopefully) version of the code. @ECHO OFF:: Ensure ADMIN Privileges - from http://www.robvanderwoude.com/clevertricks.php:: adaptation of https://sites.google.com/site/eneerge/home/BatchGotAdmin and http://stackoverflow.com/q/4054937:: Check for ADMIN Privileges >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"IF '%errorlevel%' NEQ '0' ( REM Get ADMIN Privileges ECHO= Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" ECHO= UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" DEL "%temp%\getadmin.vbs" EXIT /B) ELSE ( REM Got ADMIN Privileges PUSHD "%CD%" CD /D "%~dp0"):: END - Ensure ADMIN Privileges:: PrelimsSETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONSSET "_OSV=" & FOR /f "TOKENS=2 DELIMS=[]" %%A IN ('VER') DO FOR /f "TOKENS=2,3 DELIMS=. " %%B IN ("%%~A") DO SET "_OSV=%%B.%%C"IF %_OSV% LSS 5.1 ECHO= This requires XP or greater & EXIT /bSET "_Arch=x64" & IF %PROCESSOR_ARCHITECTURE%==x86 IF NOT DEFINED PROCESSOR_ARCHITEW6432 SET "_Arch=x86"ECHO PLease specify if the following programs needs to be installed. y for yes and n for noSET "AVG=N" & SET /p AVG=Do you want to Install AVG(Y/N)):: Begin work:: Installsecho Installing Firefox & ffox29.exe -msecho Installing Ashampoo & ashampoo.exe /sp- /verysilent /norestartecho Installing C-Cleaner & ccsetup.exe /Secho Installing K-lite & klite.exe /verysilent /norestartEcho Adding Reg Key for No Autorun & NOAUTORUN.regecho Killing Task & taskkill /f /im "burningstudio.exe"Echo Installing Adobe Reader & adobe11.exe /sPB /sAll /msi /norestart ALLUSERS=1 EULA_ACCEPT=YESIF %_OSV% LSS 6.0 ( ECHO= Installing Internet Explorer 8 & IE8-WindowsXP-x86-ENU.exe /passive /update-no /no-default /norestart Ren "C:\Documents and Settings\All Users\Desktop\CCleaner.lnk" "Run Weekly.lnk" Ren "C:\Documents and Settings\All Users\Desktop\Mozilla Firefox.lnk" "Internet.lnk" Del "C:\Documents and Settings\All Users\Desktop\Your Software Deals.lnk") ELSE ( ECHO= Internet Explorer 8 Not Required & ECHO= Disabling Hibernation & POWERCFG -h off)IF /i "%AVG:~,1%." == "Y." ( echo Installing AVG%_Arch% & avg%_Arch% /UILevel=silent /InstallToolbar=0 /ChangeBrowserSearchProvider=0 /SelectedLanguage=1033 /InstallSidebar=0 /ParticipateProductImprovement=0 /DontRestart /KillProcessesIfNeeded) Else ( echo AVG Installation Skipped):: TweaksEcho Renaming Icons...Ren "c:\Users\Public\Desktop\CCleaner.lnk" "Run Weekly.lnk"Ren "c:\Users\Public\Desktop\Mozilla Firefox.lnk" "Internet.lnk"Del "c:\Users\Public\Desktop\Your Software Deals.lnk" Echo Renaming Doneecho Disabling System RestoreReg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" /v DisableSR /t REG_DWORD /d 1 /fsc config srservice start= disablednet stop srservice:: CleanupFOR %%A IN ( ffox29.exe ccsetup.exe adobe11.exe klite.exe IE8-WindowsXP-x86-ENU.exe NOAUTORUN.reg InstallV1.2.cmd ashampoo.exe avgx64.exe avgx86.exe ) DO ( ECHO Deleting file %%A ..... & DEL %%A)SET /p CONTINUE=Installs Complete.... Please install Libre Office and Adobe Update manually.exit /bThank you for everybody's help and suggestions. Do you see room for improvement? except for those rename commands when installing ie? You will see that i removed LibreOffice installation due to it crashing the batch file. and the NoAutorun.reg needs me to click Yes and OK.
  2. I have another problem with the batch. In windows vista or later the batch file requires administrative rights to disable hibernation , rename icons and install certain software and it still ends suddenly past a certain point... @echo offECHO PLease specify if the following programs needs to be installed. y for yes and n for noSET AVG=NSET /p AVG=Do you want to Install AVG(Y/N)IF EXIST "%PROGRAMFILES%\Microsoft Office\" ( ECHO Microsoft Office Detected!! SET LIBRE=N SET /p LIBRE=Do you want to Install Libre Office(Y/N))echo Installing Firefoxffox29.exe -msecho Installing Ashampooashampoo.exe /sp- /verysilent /norestartecho Installing C-Cleanerccsetup.exe /Secho Installing K-liteklite.exe /verysilent /norestartEcho Adding Reg Key for No AutorunNOAUTORUN.regEcho Installing Adobe Readeradobe11.exe /sPB /sAll /msi /norestart ALLUSERS=1 EULA_ACCEPT=YESEcho Installing Adobe Reader UpdateAdbeRdrUpd11006_MUI.msp /qp /norestartSET "_OSV="FOR /F "TOKENS=1* DELIMS=[" %%A IN ('VER') DO (SET "_OSV=%%B" CALL SET "_OSV=%%_OSV:* =%%" & CALL SET "_OSV=%%_OSV:~,3%%")IF %_OSV% LSS 5.1 GOTO :EOFIF %_OSV% LSS 6.0 (ECHO= Installing Internet Explorer 8 IE8-WindowsXP-x86-ENU.exe /passive /update-no /no-default /norestart) ELSE ( ECHO= Internet Explorer 8 Not Required & ECHO= Disabling Hibernation POWERCFG -h off)(program ends after this)IF /i %AVG% == Y ( IF %PROCESSOR_ARCHITECTURE% EQU x64 ( echo Installing AVG x64 avgx64 /UILevel=silent /InstallToolbar=0 /ChangeBrowserSearchProvider=0 /SelectedLanguage=1033 /InstallSidebar=0 /ParticipateProductImprovement=0 /DontRestart /KillProcessesIfNeeded ) ELSE ( echo Installing AVG x86 avgx86 /UILevel=silent /InstallToolbar=0 /ChangeBrowserSearchProvider=0 /SelectedLanguage=1033 /InstallSidebar=0 /ParticipateProductImprovement=0 /DontRestart /KillProcessesIfNeeded )) Else ( echo AVG Installation Skipped)IF /i %LIBRE% == Y( Echo Installing Libre Office LibreOffice_4.2.3_Win_x86.msi ALLUSERS=1 /q /norestart)Echo Renaming Icons...Ren "%USERPROFILE%\Desktop\CCleaner.lnk" "Run Weekly.lnk"Ren "%USERPROFILE%\Desktop\Mozilla Firefox.lnk" "Internet.lnk"Echo Renaming Doneecho Disabling System RestoreReg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" /v DisableSR /t REG_DWORD /d 1 /fsc config srservice start= disablednet stop srserviceecho Deleting Files del ffox29.exe del ccsetup.exe del adobe11.exe del klite.exe del IE8-WindowsXP-x86-ENU.exe del NOAUTORUN.reg del Install V1.1.bat del ashampoo.exe del avgx64.exe del avgx86.exe del LibreOffice_4.2.3_Win_x86.msi del AdbeRdrUpd11006_MUI.mspecho Operation Completeexit /b
  3. @Wise Owl C:\Users\ does not exist on Windows XP unless it is manually created. Easy way to identify Type of OS. This is my way of identifying the OS. I do java coding , but this is my first time creating a batch. As the owner buys the new components. i do the assembly , windows installation etc do basicly im creating a script so that i can just copy the folder over to the pc and run the script. i am still getting to the power settings for sleep as i am getting the time. Updated Version @echo offecho Installing Firefoxffox29.exe -msecho Installing Ashampooashampoo.exe /sp- /verysilent /norestartecho Installing C-Cleanerccsetup.exe /Secho Installing K-liteklite.exe /verysilent /norestartEcho Adding Reg Key for No AutorunNOAUTORUN.regEcho Installing Adobe Readeradobe11.exe /sPB /sAll /msi /norestart ALLUSERS=1 EULA_ACCEPT=YESEcho Installing Adobe Reader UpdateAdbeRdrUpd11006_MUI.msp /qp /norestartIF NOT EXIST "C:\Users\" ( echo Installing Internet Explorer 8 IE8-WindowsXP-x86-ENU.exe /passive /update-no /no-default /norestart) ELSE ( Echo Internet Explorer 8 Not Required)SET AVG=NSET /p AVG=Do you want to Install AVG(Y/N)IF /i %AVG% == Y ( IF %PROCESSOR_ARCHITECTURE% EQU x64 ( echo Installing AVG x64 avgx64 /UILevel=silent /InstallToolbar=0 /ChangeBrowserSearchProvider=0 /SelectedLanguage=1033 /InstallSidebar=0 /ParticipateProductImprovement=0 /DontRestart /KillProcessesIfNeeded ) ELSE ( echo Installing AVG x86 avgx86 /UILevel=silent /InstallToolbar=0 /ChangeBrowserSearchProvider=0 /SelectedLanguage=1033 /InstallSidebar=0 /ParticipateProductImprovement=0 /DontRestart /KillProcessesIfNeeded )) Else ( echo AVG Installation Skipped)IF EXIST "%PROGRAMFILES%\Microsoft Office\" ( ECHO Microsoft Office Detected!!) ELSE ( SET LIBRE=N SET /p LIBRE=Do you want to Install Libre Office(Y/N) IF /i %LIBRE% == Y( Echo Installing Libre Office LibreOffice_4.2.3_Win_x86.msi ALLUSERS=1 /q /norestart ))Echo Renaming Icons...Ren "%USERPROFILE%\Desktop\CCleaner.lnk" "Run Weekly.lnk"Ren "%USERPROFILE%\Desktop\Mozilla Firefox.lnk" "Internet.lnk"Echo Renaming DoneEcho Disabling Hibernationif exists "C:\users\" ( cmd.exe /c powercfg.exe -h off)echo Disabling System RestoreReg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" /v DisableSR /t REG_DWORD /d 1 /fsc config srservice start= disablednet stop srserviceecho Deleting Files del ffox29.exe del ccsetup.exe del adobe11.exe del klite.exe del IE8-WindowsXP-x86-ENU.exe del NOAUTORUN.reg del Install V1.1.bat del ashampoo.exe del avgx64.exe del avgx86.exe del LibreOffice_4.2.3_Win_x86.msi del AdbeRdrUpd11006_MUI.mspecho Operation Completeexit /bDo you see any room for coding improvements?
  4. @Yzowl The only operating system that does not use c:\users\ is xp which is "Documents and Settings" and we do not use anything lower than xp. I did notice the AVG mistake and fixed it. I disable hibernation due to the network setup i have so id rather set the pc's so sleep in 30 minutes than shutdown down to hibernation and hibernation takes longer to startup. This script is intended for setting up a new pc. Once the script is done running, i want it to delete itself (thus the del Install V1.1.bat) and the installation files. @jaclaz Thanks for the speedy reply. I will reply if it fixed the problem.
  5. Hey I am a general computer admin managing 10+ pcs. I tried writing a batch to install and update new programs but it keeps exiting at the if statement. Please help @echo offffox29.exe -msccsetup.exe /Sklite.exe /verysilent /norestart(THE PROBLEM IS HERE)If NOT exist "C:\Users"( echo Installing Internet Explorer 8 IE8-WindowsXP-x86-ENU.exe /passive /update-no /no-default /norestart)ELSE( Echo Internet Explorer 8 Not Required)SET /p AVG=Do you want to Install AVG(Y/N)IF %AVG% EQU y( IF %PROCESSOR_ARCHITECTURE% EQU x64 ( echo Installing AVG x64 avg x64 /UILevel=silent /InstallToolbar=0 /ChangeBrowserSearchProvider=0 /SelectedLanguage=1033 /InstallSidebar=0 /ParticipateProductImprovement=0 /DontRestart /KillProcessesIfNeeded ) ELSE ( echo Installing AVG x86 avg x86 /UILevel=silent /InstallToolbar=0 /ChangeBrowserSearchProvider=0 /SelectedLanguage=1033 /InstallSidebar=0 /ParticipateProductImprovement=0 /DontRestart /KillProcessesIfNeeded ))Else( echo AVG Installation Skipped)SET /p LIBRE=Do you want to Install Libre Office(Y/N)IF %LIBRE% EQU y( Echo Installing Libre Office LibreOffice_4.2.3_Win_x86.msi ALLUSERS=1 /q /norestart)Echo Renaming Icons...Ren "%USERPROFILE%\Desktop\CCleaner.lnk" "Run Weekly.lnk"Ren "%USERPROFILE%\Desktop\Mozilla Firefox.lnk" "Internet.lnk"Echo Renaming DoneEcho Disabling Hibernationif exists C:\users( cmd.exe /c powercfg.exe -h off)echo Deleting Files del ffox29.exe del ccsetup.exe del klite.exe del Install V1.1.bat del avg x64.exe del avg x86.exe del LibreOffice_4.2.3_Win_x86.msiecho Operation Completeexit /b
×