Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

"Continue was unexpected at the time" error occured

superwj5superwj5 Posts: 1Member
Hello, i have been writing a code to report the dpi of the screen and change it. However, everytime i execute the code, after entering the dpi i want to change to, it shows "continue was unexpected at this time." What is the problem? How should i fix it?
Here is the code for dpichanger.cmd:
[code]@echo off
echo.>backupdpi.txt
echo.>backupdpihex.txt
cscript readreg.vbs backupdpi.txt>nul
set /p backupdpi=nul
set /p backupdpihex=> backupdpi.reg
echo. >> backupdpi.reg
echo [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionFontDPI] >> backupdpi.reg
echo "LogPixels"=dword:%backupdpihex% >> backupdpi.reg
echo. >> backupdpi.reg
move /y backupdpi.reg %windir%system32configRegBackDPIBackup>nul
echo Current DPI[Decimal:%backupdpi% Hexadecimal:%backupdpihex%]
:error
echo.
echo What is your desired dpi? Please enter in decimal.
echo.
set /p /a newdpi=
echo.
echo Please confirm your value
echo.
set /p /a newdpiconfirm=
if %newdpi%==%newdpiconfirm% goto continue
cls
echo Sorry, your entered values do not seem to match.
goto error
:continue
pause
echo.>newdpihex.txt
cscript dec2hex.vbs %newdpi% %CD%
ewdpihex.txt>nul
set /p newdpi=> newdpi.reg
echo. >> newdpi.reg
echo [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionFontDPI] >> newdpi.reg
echo "LogPixels"=dword:%newdpi% >> newdpi.reg
echo. >> newdpi.reg
regedit /s newdpi.reg
pause
cls
echo Operation execution completed...
echo Do you wish to logoff now?
choice
if errorlevel 2 start goto end
if errorlevel 1 goto manual
:manual
echo Do you wish to logoff manually?
choice
if errorlevel 2 goto refresh
if errorlevel 1 goto logoff
refresh:
taskkill /im explorer.exe /f
taskkill /im dwm.exe /f
explorer.exe
dwm.exe
goto end
:logoff
pause
shutdown -l
:end
echo Have a nice day!
pause
exit[/code]

And here is the code for the readreg.vbs above:
[code]strFileName = Wscript.Arguments(0)
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFileName, 2)
objFile.WriteLine(WshShell.RegRead("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionFontDPILogPixels"))
objFile.Close
[/code]

And here is the code for the dec2hex.vbs above:
[code]DecVal = Wscript.Arguments(0)
strFileName = Wscript.Arguments(1)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFileName, 2)
objFile.WriteLine(hex(DecVal))
objFile.Close
[/code]

Thanks in advance!
Sign In or Register to comment.