I am having an issue with a script. I will post it.
It runs fine till it gets to this line:
wmic diskdrive list full | findstr /B "Size=" >> %cd%ProductCodes\%Serial%\PCINFO.txt
This is what it sends to the file...
楓敺ㄽ㐲ㄱ㈱㤴㈹ര楓敺㈽㘵㔰㤲㘶〴ര
Any help would be appreciated
set drive=%cd:~0,3%
#echo off
for /F "skip=2 tokens=2 delims=," %%A in ('wmic systemenclosure get serialnumber /FORMAT:csv') do (set "serial=%%A")
mkdir %cd%ProductCodes\%Serial%
wmic path softwarelicensingservice get OA3xOriginalProductKey >> %cd%ProductCodes\%Serial%\Code.txt
wmic computersystem get model,manufacturer >> %cd%ProductCodes\%Serial%\PCINFO.txt
wmic cpu get name >> %cd%ProductCodes\%Serial%\PCINFO.txt
wmic ComputerSystem get TotalPhysicalMemory >> %cd%ProductCodes\%Serial%\PCINFO.txt
wmic diskdrive list full | findstr /B "Size=" >> %cd%ProductCodes\%Serial%\PCINFO.txt
cls
More %cd%ProductCodes\%Serial%\Code.txt
ECHO Open Windows Authentication?
Echo Y/N
SET /P M=Make Choice then press ENTER:
IF %M%==N GOTO :message
IF %M%==n GOTO :message
IF %M%==y GOTO :Start
IF %M%==Y GOTO :Start
:Start
start "C:\Windows\System32" slui.exe 3
pause
:message
CLS
ECHO Done!!
pause
Here is the requested output I get
Manufacturer Model
HP HP ZBook 15 G5
Name
Intel(R) Core(TM) i5-8300H CPU # 2.30GHz
TotalPhysicalMemory
16977272832
楓敺ㄽ㐲ㄱ㈱㤴㈹ര楓敺㈽㘵㔰㤲㘶〴ര
Have a look at this. I made quite a few changes, especially the way you accessed the format of wmic output formats. I also used choice instead of a bunch of if statements.
#echo off
for /f "tokens=2 delims==" %%A in ('wmic systemenclosure get serialnumber /FORMAT:list') do mkdir "%~dp0\ProductCodes\%Serial%" >nul 2>&1
for /f "tokens=2delims==" %%i in ('wmic path softwarelicensingservice get OA3xOriginalProductKey /format:list') do (echo %%i)>"%~dp0\ProductCodes\%Serial%\code.txt"
(wmic computersystem get model,manufacturer
wmic cpu get name
wmic ComputerSystem get TotalPhysicalMemory
wmic diskdrive get size
)> "%~dp0\ProductCodes\%Serial%\PCINFO.txt"
cls
More "ProductCodes\%Serial%\code.txt"
ECHO Open Windows Authentication?
choice /m "Open Authentication?"
if errorlevel 2 goto :message
goto :eof
:Start
start "C:\Windows\System32" slui.exe 3
pause
:message
cls
ECHO Done!!
pause
Side note on your original if %m%==y statements. You can use if /i to make the match case insensitive.. in other words, if /i "y"=="Y" will be true as well, but no longer relevant here if using choice.
You can give a try for this modification with piping the command More since the output of WMIC is UNICODE
#echo off
#for /F "skip=2 tokens=2 delims=," %%A in (
'wmic systemenclosure get serialnumber /FORMAT:csv'
) do (set "serial=%%A")
Set "LogFolder=%cd%ProductCodes\%Serial%"
MkDir "%LogFolder%">nul 2>&1
Set "Code=%LogFolder%\Code.txt"
Set "PCINFO=%LogFolder%\PCINFO.txt"
wmic path softwarelicensingservice get OA3xOriginalProductKey>"%code%"
(
wmic computersystem get model,manufacturer
wmic cpu get name
wmic ComputerSystem get TotalPhysicalMemory
wmic diskdrive list full ^| findstr /B "Size="
) | More>"%PCINFO%"
More "%Code%"
ECHO Open Windows Authentication?
Echo Y/N
SET /P M=Make Choice then press ENTER:
IF /I %M%==N GOTO :message
IF /I %M%==Y GOTO :Start
:Start
start "C:\Windows\System32" slui.exe 3
pause
:message
CLS
ECHO Done!!
pause
Related
Im new to learning to code batch files.
Basically I have this script
#echo off
echo.
echo Current Serials-
echo.
wmic bios get serialnumber
wmic diskdrive get serialnumber
wmic baseboard get serialnumber
pause
Which has this output
Current Serials-
SerialNumber
Insert Serial Number Here
SerialNumber
Insert Serial Number Here
Insert Serial Number Here
SerialNumber
Insert Serial Number Here
But I want the output to look like this
Current Serials-
Bios SerialNumber- Insert Serial Number Here
Diskdrive SerialNumber- Insert Serial Number Here, Insert Serial Number Here
BaseBoard SerialNumber- Insert Serial Number Here
So how do I do that?
The simplest approach is using a for /F loop to catch and split the output of wmic
#Echo off
Echo(Current Serial numbers:
For %%A in (Bios Diskdrive Baseboard) Do (
For /F "Skip=1 Delims=" %%G in ('WMIC %%A get serialnumber') Do (
For %%O in (%%G)Do Echo(%%A Serial Number: %%O
))
To process files, strings or command outputs, use a for loop. See for /? (then read it again - it's one of the mightiest commands in cmd. Any time you invest into understanding it is a good investment.)
#echo off
setlocal enabledelayedexpansion
set "drives=Diskdrive "
for /f %%a in ('wmic diskdrive get serialnumber^|findstr .') do set "drives=!drives!%%a, "
echo %drives:~0,-2%
As you are new to cmd, let me suggest SS64. Save it as favorite and visit it often.
You could probably do it in a single line from your batch-file, with the help of powershell:
#PowerShell -NoP "Write-Host Current Serials-`r`n`r`nBIOS - $(GCim CIM_BIOSElement).SerialNumber`r`nPrimary Disk - $(GCim CIM_DiskDrive -F \"DeviceID Like '%%PHYSICALDRIVE0'\").SerialNumber.Trim()`r`nMotherboard - $(Get-CimInstance -Query \"Select * From CIM_Card Where Name='Base Board'\").SerialNumber"
Because serialnumbers contains numeric, but the empty lines and the word Serianumber does not, I use findstr to determine which lines are serials and only echo them.
#echo off
for %%i in (Bios Diskdrive Baseboard) do (
for /f "delims=" %%a in ('wmic %%~i get serialnumber ^| findstr /r "[0-9]"') do echo %%~i Serialnumber- %%a
)
Just another option if you just want to use the standard output from the WMIC commands.
set /p ".=BIOS "<nul&wmic bios get serialnumber /value|more|findstr /I "serial"
set /p ".=DISKDRIVE "<nul&wmic diskdrive get serialnumber /value|more|findstr /I "serial"
set /p ".=BASEBOARD "<nul&wmic baseboard get serialnumber /value|more|findstr /I "serial"
Which would give you output like this.
BIOS SerialNumber=3ZB80R2
DISKDRIVE SerialNumber=0100_0000_0000_0000_8CE3_8E04_0016_7812.
BASEBOARD SerialNumber=/3ZB80R2/TW320709A3011C/
Or you could simplify it with a FOR command.
FOR %%G IN (BIOS DISKDRIVE BASEBOARD) DO set /p ".=%%G "<nul&wmic %%G get serialnumber /value|more|findstr /I "serial"
If you need to get all disk serial numbers on the same line also delimited by a comma...
#echo off
set "_str=SerialNumber"
echo\ & echo\Current Serials-
setlocal enabledelayedexpansion
set "_gets=Bios,DiskDrive,BaseBoard"
set "_wmic=%__AppDir__%wbem\wmic.exe"
echo\ & for %%i in (!_gets!)do for /f usebackq %%I in (`
!_wmic! %%i get %_str%^|%__AppDir__%Findstr.exe/v %_str%^|%__AppDir__%Findstr.exe .
`)do echo\%%i;|%__AppDir__%Findstr.exe /bl Bios; >nul && (echo\%%i !_str!- %%I
)|| if /i "%%~i" == "BaseBoard" (echo=!_sn!&& echo\%%~i !_str!- %%~I
)else if "!_sn!" == "" (set "_sn=%%~i !_str!- %%~I"
)else set "_sn=!_sn!, %%~I"
>con: %__AppDir__%TimeOut.exe -1|echo\Press any key to continue... & endlocal & goto :eOf
Results
Current Serials-
Bios SerialNumber- XTE03A187
DiskDrive SerialNumber- 50026B776605D1D3, ZDZ0QKMT
BaseBoard SerialNumber- S0AFF01XDTS
Press any key to continue...
In conventional layout:
#echo off
setlocal enabledelayedexpansion
echo\
echo\Current Serials-
echo\
for %%i in (Bios,DiskDrive,BaseBoard)do (
for /f usebackq %%I in (`%__AppDir__%wbem\wmic.exe %%i get SerialNumber^|%__AppDir__%Findstr.exe/v SerialNumber^|%__AppDir__%Findstr.exe .`)do (
echo\%%i;|%__AppDir__%Findstr.exe /bl Bios; >nul && (
echo\%%i SerialNumber- %%I ) || (
if /i "%%~i" == "BaseBoard" (
echo=!_sn!&& echo\%%~i SerialNumber- %%~I
) else if "!_sn!" == "" (
set "_sn=%%~i SerialNumber- %%~I"
) else (
set "_sn=!_sn!, %%~I"
)
)
)
%__AppDir__%TimeOut.exe -1
endlocal
How to get pc mac address and restart PC if mac is not on the list.txt?, i only have this getting mac command,
for /f "tokens=3 delims=," %%a in ('"getmac /v /fo csv | findstr Ethernet"') do set MAC=%%a
echo MAC address of this computer is %MAC%
You use getmac and pipe the result through findstr to filter on the required network adaptor.
You store the result into a variable ThisPCMAC
You use the type command to get the content of the list.txt file piped through findstr to filter on ThisPCMAC.
You store the result into a variable FoundMAC.
If FoundMAC is defined you goto :norestart
If FoundMAC is not defined you goto :restart
In :restart, you call shutdown /r with the required additional params
If mistaken, you can call shutdown /a in the allotted time (10 minutes here, see /t 600).
For further help, see shutdown /?
The 2 files should be in the same directory.
Example content of list.txt:
FF-AA-BB-CC-DD-FA
FF-AA-BB-CC-DD-FB
FF-AA-BB-CC-DD-FC
Content of RestartIfThisPCMACnotInList.bat:
#echo off
set ScriptPath=%~dp0
set ThisPCMAC=
set FoundMAC=
echo.
echo ScriptPath = %ScriptPath%
for /f "tokens=3 delims=," %%a in ('"getmac /v /fo csv | findstr Ethernet"') do set ThisPCMAC=%%a
echo.
echo MAC address of this computer is %ThisPCMAC%
for /F "usebackq delims==" %%b in (`"type %ScriptPath%list.txt | findstr %ThisPCMAC%"`) do set FoundMAC=%%b
if DEFINED FoundMAC (
goto :norestart
) else (
goto :restart
)
:norestart
echo.
echo Found %FoundMAC% in %ScriptPath%list.txt: Nothing to do.
goto :end
:restart
echo.
echo %ThisPCMAC% not found in %ScriptPath%list.txt: Restarting...
echo.
echo shutdown /r /f /t 600 /d p:00:00
shutdown /r /f /t 600 /d p:00:00
echo.
echo Cancel restart with the following command:
echo shutdown /a
goto :end
:end
echo.
echo %~fp0 ended.
pause
Example output for :norestart:
C:\test\>RestartIfThisPCMACnotInList.bat
ScriptPath = C:\test\
MAC address of this computer is "FF-AA-BB-CC-DD-FA"
Found FF-AA-BB-CC-DD-FA in C:\test\list.txt: Nothing to do.
C:\test\RestartIfThisPCMACnotInList.bat ended.
Press any key to continue . . .
Example output for :restart:
C:\test\>RestartIfThisPCMACnotInList.bat
ScriptPath = C:\test\
MAC address of this computer is "FF-AA-BB-CC-DD-FD"
"FF-AA-BB-CC-DD-FD" not found in C:\test\list.txt: Restarting...
shutdown /r /f /t 600 /d p:00:00
Cancel restart with the following command:
shutdown /a
C:\test\RestartIfThisPCMACnotInList.bat ended.
Press any key to continue . . .
I am attempting to create a basic script that runs and checks for basic system info but I want the output to be formatted so the results are on the same line and easily readable.
#Echo Off
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
wmic cpu get name, status
systeminfo | findstr /C:"Total Physical Memory"
#echo off & setlocal ENABLEDELAYEDEXPANSION
SET "volume=C:"
FOR /f "tokens=1*delims=:" %%i IN ('fsutil volume diskfree %volume%') DO (
SET "diskfree=!disktotal!"
SET "disktotal=!diskavail!"
SET "diskavail=%%j"
)
FOR /f "tokens=1,2" %%i IN ("%disktotal% %diskavail%") DO SET "disktotal=%%i"& SET "diskavail=%%j"
ECHO(Total Space: %disktotal:~0,-9% GB
ECHO(Available Space: %diskavail:~0,-9% GB
systeminfo | find "System Boot Time:"
systeminfo | find "System Type:"
Echo Antivirus: & wmic /node:localhost /namespace:\\root\SecurityCenter2 path AntiVirusProduct Get DisplayName | findstr /V /B /C:displayName || echo No Antivirus installed
The main example of this would be the wmic command placing the result on the next line rather than the same line.
Also any tips of better ways of scripting what I currently have would be appreciated.
#echo off
setlocal
for /f "tokens=1,* delims=:" %%A in ('systeminfo') do (
if "%%~A" == "OS Name" (
call :print "%%~A" %%B
) else if "%%~A" == "OS Version" (
call :print "%%~A" %%B
call :cpu
) else if "%%~A" == "Total Physical Memory" (
call :print "%%~A" %%B
call :fsutil C:
) else if "%%~A" == "System Boot Time" (
call :print "%%~A" %%B
) else if "%%~A" == "System Type" (
call :print "%%~A" %%B
)
)
:next
call :antivirus
pause
exit /b
:print
setlocal enabledelayedexpansion
set "name=%~1"
if not defined name exit /b
set "name=%~1 "
set "full=%*"
set "full=!full:,=!"
set "data="
set "skip1="
for %%A in (!full!) do (
if not defined skip1 (
set "skip1=defined"
) else if not defined data (
set "data=%%~A"
) else (
set "data=!data! %%~A"
)
)
echo !name:~,30!: !data!
exit /b
:antivirus
setlocal enabledelayedexpansion
set "antivirus="
for /f "tokens=*" %%A in ('
2^>nul wmic /node:localhost
/namespace:\\root\SecurityCenter2 path AntiVirusProduct
Get DisplayName /value
^| findstr /i /b /c:"DisplayName" ^|^| echo No Antivirus installed
') do set "antivirus=%%~A"
if /i "!antivirus:~,12!" == "DisplayName=" set "antivirus=!antivirus:~12!"
call :print Antivirus "!antivirus!"
exit /b
:cpu
for /f "tokens=1,* delims==" %%A in ('wmic cpu get name^, status /value') do (
call :print "%%~A" %%B
)
exit /b
:fsutil
setlocal enabledelayedexpansion
2>nul >nul net session || exit /b
for /f "tokens=1,* delims=:" %%A in ('2^>nul fsutil volume diskfree %1') do (
set "name=%%~A"
set "value=%%~B"
call :print "!name:bytes=GBs!" !value:~,-9!
)
exit /b
The fsutil command outputs alittle different.
I chose an easy option if it is OK.
Unsure of antivirus output as you need both results of
installed or not to be sure.
It only runs systeminfo once to save time.
Look at set /? for information about substitution that
is used.
The net session command is used to test if script is run as Admin.
If not Admin, then fsutil will be skipped as it requires Admin.
Look at for /? for usage of the command that is used in the script.
Use of enabledelayedexpansion is used to prevent special
characters being exposed which may cause error otherwise.
And used in code blocks to delay expansion as needed.
Remove comma from value strings which get replaced with a space.
A comma is often used as thousands separator and numbers look odd
with a space instead. This occurs because of usage of a simple
for loop interpreting comma as a argument separator. Some other
chararters may also do this though perhaps a space maybe better
than none in their case.
The output of WMIC is unicode !
The trailing <CR> can be removed by passing the value through another FOR /F loop. This also removes the phantom "blank" line (actually a <CR>)
#Echo Off
Call :GET_CPU name CPU_Name
Set "WMIC_Antivirus=wmic /node:localhost /namespace:\\root\SecurityCenter2 path AntiVirusProduct Get DisplayName ^| findstr /V /B /C:displayName"
#For /F "delims=" %%I in ('%WMIC_Antivirus%') do (
for /f "delims=" %%A IN ("%%I") DO SET "Antivirus=%%A"
)
echo CPU : %CPU_Name%
echo Antivirus : %Antivirus%
pause & exit
::----------------------------------------------------
:GET_CPU
Set "WMIC_CPU=wmic cpu get name /Value"
FOR /F "tokens=2 delims==" %%I IN (
'%WMIC_CPU% ^| find /I "%~1" 2^>^nul'
) DO FOR /F "delims=" %%A IN ("%%I") DO SET "%2=%%A"
Exit /b
::----------------------------------------------------
You can try to save the output into a text file :
#Echo Off
:::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights
:::::::::::::::::::::::::::::::::::::::::
REM --> Check for permissions
Reg query "HKU\S-1-5-19\Environment" >nul 2>&1
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
Echo.
ECHO **************************************
ECHO Running Admin shell... Please wait...
ECHO **************************************
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
::::::::::::::::::::::::::::
::START
::::::::::::::::::::::::::::
SetLocal EnableDelayedExpansion
set "Log=%~dp0Log.txt"
If exist "%Log%" Del "%Log%"
Call :GET_CPU name CPU_Name
Set "WMIC_Antivirus=wmic /node:localhost /namespace:\\root\SecurityCenter2 path AntiVirusProduct Get DisplayName ^| findstr /V /B /C:displayName"
#For /F "delims=" %%I in ('%WMIC_Antivirus%') do (
for /f "delims=" %%A IN ("%%I") DO SET "Antivirus=%%A"
)
(
Echo.
Echo ***************************** General infos ***********************************
Echo.
Echo Running under: %username% on profile: %userprofile%
Echo Computer name: %computername%
Echo.
systeminfo
Echo Operating System:
Echo PROCESSOR ARCHITECTURE : %PROCESSOR_ARCHITECTURE%
echo NUMBER_OF_PROCESSORS : %NUMBER_OF_PROCESSORS%
echo PROCESSOR_IDENTIFIER : %PROCESSOR_IDENTIFIER%
echo PROCESSOR_LEVEL : %PROCESSOR_LEVEL%
echo PROCESSOR_REVISION : %PROCESSOR_REVISION%
echo OS TYPE : %OS%
echo(
echo Program files path : %Programfiles%
echo Program files(86^) path : %Programfiles(86^)%
echo ProgramW6432 path : %ProgramW6432%
echo PSModulePath : %PSModulePath%
echo SystemRoot : %SystemRoot%
echo Temp Folder : %Temp%
echo CPU : !CPU_Name!
echo Antivirus : !Antivirus!
Echo.
Echo **************************** Drives infos *************************************
Echo.
Echo Listing currently attached drives:
wmic logicaldisk get caption,description,volumename | find /v ""
Echo.
Echo Physical drives information:
for /F "tokens=1-3" %%A in ('fltmc volumes^|find ":"') do echo %%A %%B %%C
)>>"%Log%"
Start "" "%Log%" & exit
::----------------------------------------------------
:GET_CPU
Set "WMIC_CPU=wmic cpu get name /Value"
FOR /F "tokens=2 delims==" %%I IN (
'%WMIC_CPU% ^| find /I "%~1" 2^>^nul'
) DO FOR /F "delims=" %%A IN ("%%I") DO SET "%2=%%A"
Exit /b
::----------------------------------------------------
Im making a cool hidden folder passworded USB drive. I have a little image that opens and I want to play music using this code.
set "file=music.mp3"
( echo Set Sound = CreateObject("WMPlayer.OCX.7"^)
echo Sound.URL = "%file%"
echo Sound.Controls.play
echo do while Sound.currentmedia.duration = 0
echo wscript.sleep 100
echo loop
echo wscript.sleep (int(Sound.currentmedia.duration^)+1^)*1000) >sound.vbs
start /min sound.vbs
I want to end the music after the user types the password. Or just the ability to tell it to stop.
I found in another post on here a solution by a user but he doesnt explain how to use it. Here is the link to that post. Link to the post Im new to batch so just giving me a script wont help I kind of need to know how to use it.
This is the script I dont understand how to use that will stop the music. According to the post I linked.
#ECHO OFF >NUL
for /F "usebackq tokens=*" %%G in (
`wmic process where "CommandLine like '%%sound.vbs%%' AND Caption like '%%script.exe%%'" get ProcessID/value ^|find /I "="`
) do (
rem echo %%G
for /F "tokens=2 delims==" %%H in ("%%~G") do echo taskkill /T /F /PID %%H
)
Here is the password code im using.
#echo off
set pass= 123abc
echo Enter Password
set /p ui=
if %ui%==%pass% (goto open)
echo Wrong Password
pause
exit
:open
start folder
How to stop the music
Note taskkill command is echoed merely... Remove echo when debugged.
see instruction by #JosefZ here : https://stackoverflow.com/a/29271203/9222942
remove the 'echo' word from this line :
for /F "tokens=2 delims==" %%H in ("%%~G") do echo taskkill /T /F /PID
will becomes :
for /F "tokens=2 delims==" %%H in ("%%~G") do taskkill /T /F /PID
#ECHO OFF >NUL
for /F "usebackq tokens=*" %%G in (
`wmic process where "CommandLine like '%%sound.vbs%%' AND Caption like '%%script.exe%%'" get ProcessID/value ^|find /I "="`
) do (
rem echo %%G
for /F "tokens=2 delims==" %%H in ("%%~G") do echo taskkill /T /F /PID %%H
)
I have executed the below command in command prompt.
Input:
C:\>#for /f "skip=1" %p in ('wmic cpu get loadpercentage') do #echo %p%
8%
%
I have written the code to get only 8% in batch script like below,
call :Harddisk
call :CPU
Echo ^</TABLE^> ^</BODY^> ^</HTML^> >> %opfile%
pause
exit /b
:CPU
set wmih=#for /f skip=1 %p in ('wmic cpu get loadpercentage') do #echo %p% |Find /c /v ":"
ECHO wmih
for /f "tokens=1,2,3,4,5" %%a in ('"%wmih%"') do (
Echo ^<TR^> ^<TD^> >> %opfile%
Echo CPU Utilization: %%a >> %opfile%
Echo ^</TD^> ^</TR^> >> %opfile%
)
exit /b
I'm not getting proper output. Please help me to sort it out.
Thanks!!!
for /f "tokens=2 delims==" %%i in ('wmic cpu get loadpercentage /value ^|find "="') do echo set p=%%i
set p=%p:~0,-1%
echo %p%
Just to keep your structure
:CPU
set "wmih=#for /f "usebackq skip^^^=2 tokens^^^=2 delims^^^=^^^," %%p in (`wmic cpu get loadpercentage^^^,version /format^^^:csv`) do #echo(%%p%%"
ECHO %wmih%
for /f "tokens=1,2,3,4,5" %%a in ('"%wmih%"') do (
>>%opfile% Echo ^<TR^> ^<TD^>
>>%opfile% Echo CPU Utilization: %%a
>>%opfile% Echo ^</TD^> ^</TR^>
)
To be able to store the command inside a variable and then pass it to the for command, that will spawn another cmd instance to execute the command, you need a lot of scape characters just to handle the command execution.
It can be made easier
:CPU
for /f "skip=2 tokens=2 delims=," %%a in (
'wmic cpu get loadpercentage^,version /format^:csv'
) do (
>>%opfile% Echo ^<TR^> ^<TD^>
>>%opfile% Echo CPU Utilization: %%a%%
>>%opfile% Echo ^</TD^> ^</TR^>
)
In both cases, to remove the aditional CR character at the end of the retrieved value, the query request the output in csv format with an aditional field, so, the needed data is not at the end of the line and the value will not include the ending CR