I am using the below script to help automate some processes that would make my work life easier. When running this current version it faults out and closes the program right as soon as the first if statement executes. Did quite a bit of research on my own and the code looks to be correct. The program closed so fast I couldn't read a reason why. So I ran all the output into a txt file. It looks as if the program faults out for a syntax reason. I unfortunately don't have the file with me and don't have the exact error. I can post it tomorrow when it is in front of me.
::Turns off unnecessary messages from Command Prompt
echo off
::Copies files over from the NAS drive that are required for setup
echo Transfering files from NAS1...
if not exist "%userprofile%\Desktop\Install_Files" mkdir %userprofile%\Desktop\Install_Files
xcopy /Y \\nas1\Volume_1\"Tech Department"\"General Windows POS Preperation"\* "%userprofile%\Desktop\Install_Files"
echo File Transfer Complete
::Start installation of Foxit Reader
echo Installing Foxit Reader...
start /w %userprofile%\Desktop\Install_Files\"FoxitReader831_current version".exe
echo Installations Complete
::Changes background by changing the file pathway in the registry value
echo Setting Background...
REG ADD "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d %userprofile%\Desktop\Install_Files\NewTMS1024x768.jpg /f
::Changes the Workgroup and Computer Name
echo Setting Computer Name...
SET /P PCNAME=Please enter computer name:
wmic computersystem where "Name='%computername%'" rename "%PCNAME%"
echo Setting Workgroup...
SET /P WGNAME=Please enter workgroup name:
Wmic computersystem where name="%computername%" call joindomainorworkgroup name="%WGNAME%"
::Selecting which POS Software to install
SET /P POSNAME=Please enter POS Software to install (a:Aldelo m:MAPOS t:TRPOS):
if /i %POSNAME% == "m"
(
::Transfers required files from NAS drive to Install Folder
echo Transferring install files...
xcopy /Y \\nas1\Volume_1\"Tech Department"\"POS Software"\MAPOS\* "%userprofile%\Desktop\Install_Files"
::Installs MAPOS and Groovv SDK for card processing
echo Installing GroovvSDK...
start /w %userprofile%\Desktop\Install_Files\GroovvSDK_Client_Setup_v3.9.6
echo Installing MAPOS...
start /w %userprofile%\Desktop\Install_Files\mapos_install
)
if /i %POSNAME% == "t"
(
::Transfers required install file for TRPOS
echo Transferring install files...
xcopy /Y \\nas1\Volume_1\"Tech Department"\"POS Software"\TRPOS\TRPOS_install.exe "%userprofile%\Desktop\Install_Files"
::Installs TRPOS
start /w %userprofile%\Desktop\Install_Files\TRPOS_install.exe
)
if /i %POSNAME% == "a"
(
)
else
(
echo No POS Software selected or improper input
)
::Force restarts the computer so changes will take effect
::shutdown.exe /r /t 00