Solved Where is the strange output coming from?

October 28, 2016 at 12:47:52
Specs: Windows 7
@ECHO OFF
SET /P X=Please enter Hostname:
Set ID=0
manage-bde -cn %X% -protectors -get c: >c:\bitlockerlog\%X%.txt
for /f "tokens=2 delims={" %%a in (%X%.txt) do (
Set ID={%%a
goto :break
)
:break
echo %ID%
*manage-bde –cn %X% -protectors -adbackup c: -id %ID%*

The part at the bottom with * around it causes strange output no matter how I try to invoke it (the * are only there for you to see it which line i'm talking about.

This is what it tells me :
C:\bitlockerlog>manage-bde ΓÇôcn HOSTNAME-D1 -protectors -adbackup c: -id {XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX}
BitLocker Drive Encryption: Configuration Tool version 6.1.7601
Copyright (C) Microsoft Corporation. All rights reserved.

ERROR: Invalid Syntax.
"ΓÇôcn" was not understood.

I tried making a new batch file with JUST
manage-bde –cn %X% -protectors -adbackup c: -id %ID%
in it and saved as .bat.
I ran that and it still generates this strange "ΓÇôcn" right before the %X% is invoked.
I tried setting that line of text to a variable before i ran the batch file and invoking that variable, but it still has it. I tried having the batch file read the whole command from a text file and saving it to a variable, and then invoking the variable.

message edited by scionave


See More: Where is the strange output coming from?

Report •

#1
October 28, 2016 at 19:17:07
✔ Best Answer
First, check your %X% (AND set x to null AND recommend setlocal):
@echo off & setlocal
set X=
SET /P X=Please enter Hostname:
:: exit if no reply to prompt
if not defined X goto :eof
echo X is %X%
>>analyz echo X is %X%
pause
::---
Does the junk show up here?
Next, set echo on, or better yet, echo out to a file, for this line:
>> analyz echo manage-bde –cn %X% -protectors -adbackup c: -id %ID%*
echo on
manage-bde –cn %X% -protectors -adbackup c: -id %ID%
echo off
Then look at the file (I called "analyz") using an edit that will show all binary material, not just text or filtered text. (notepad shows binary, but hides Unicode as plain text.)

message edited by nbrane


Report •

#2
October 31, 2016 at 06:23:21
It appears that the setlocal part fixed it. It is no longer getting that strange text. Thank you so much!


Report •
Related Solutions


Ask Question