Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RunConsole2
#1
Hello,
 
I'm trying to run the following command as administrator

manage-bde -unlock D: -RecoveryPassword XXX-XXX-XXX

run "C:\Windows\system32\manage-bde -unlock D: -RecoveryPassword XXX-XXX-XXX" "" "" "" 0x10000

or RunConsole2 version doesn't do the job.

Thank you.
#2
try running through cmd.exe

not tested

Code:
Copy      Help
int w
run "$system$\cmd.exe" "manage-bde -unlock D: -RecoveryPassword XXX-XXX-XXX" "" "" 0x10800 win("" "ConsoleWindowClass") w
#3
If want to use RunConsole2, let the macro run as administrator. Look in Properties.
#4
str s=
cd C:\WINDOWS\system32
manage-bde -status
__TempFile f.Init(".bat" "" "" s)
RunConsole2 f

gives:

C:\WINDOWS\SysWOW64>cd C:\WINDOWS\system32
C:\Windows\System32>manage-bde -status
'manage-bde' is not recognized as an internal or external command,
operable program or batch file.

but in command prompt works. Also did the run macro as administrator in Macro properties.

Works with

Code:
Copy      Help
str s=
cd C:\Windows\SysNative\
manage-bde -status
__TempFile f.Init(".bat" "" "" s)
RunConsole2 f

Thank you for your time.
#5
QM is a 32-bit program, therefore system32 is redirected to syswow64, which does not contain manage-bde.exe.
Use sysnative instead of system32. It seems cd does not recognize it; need full path.

Macro Macro51
Code:
Copy      Help
str s=
;C:\WINDOWS\sysnative\manage-bde.exe -status
__TempFile f.Init(".bat" "" "" s)
RunConsole2 f
#6
Yes Gintaras
Thank you
#7
[b]@Gintaras[/b] 

C:\Program Files\DiskGenius\DiskGenius.exe

The files in the Program Files folder can't be located under the command line. Can you tell me the real path of this folder? thank you very much Smile
#8
Paths containing spaces must be "enclosed".
#9
I have encountered an incomprehensible problem Huh

1.Direct run can be successful,

2.But run the command line is failure, Prompt not found file (I need the command line to run multiple lines of commands)

________________________________________________________________
1.

run "C:\Program Files\DiskGenius\DiskGen.exe" "/?"

________________________________________________________________
2.

str s=
F
 cd C:\Program Files\DiskGenius
 DiskGen.exe /?

out s
__TempFile f.Init(".bat" "" "" s)
RunConsole2 f
#10
I don't have DiskGenus, but I tested with another program and it works.

Macro Macro100
Code:
Copy      Help
str s=
F
;cd C:\Program Files\7-zip
;7z.exe /?

out s
__TempFile f.Init(".bat" "" "" s)
RunConsole2 f

try also
Macro Macro100
Code:
Copy      Help
str s=
F
;cd C:\Program Files\7-zip
;7z.exe /?

out s
__TempFile f.Init(".bat" "" "" s)
out f ;;see maybe path contains spaces, then need to "enclose"
RunConsole2 F"''{f}''"
#11
I found a strange problem, under normal windows 

cd C:\Program Files\DiskGenius 

can run successfully, but under the winpe system, it will prompt "the system can not find the specified path", I do not know how to solve this problem

_______________________________________________________

If I change C:\Program Files\DiskGenius  to C:\DiskGenius , it can run successfully. QM cannot be correctly positioned (Program Files)in winPE system
#12
@[b]Gintaras[/b] 

how to "enclose"?

I found the generated temporary bat file


Attached Files Image(s)
   
#13
Enclose in double quotes like in my last example with RunConsole2.
#14
Still failed, I can't take screenshots under winpe, the wrong prompt is "The system can't find the specified path"

This problem, only problems under winpe, under normal windows system, there will be no problem Huh

If I put DiskGenius in the root directory of the C drive, it will run successfully.This problem is very similar(QM can not locate the system32 folder)

————————————————————————————————————The following code can run successfully

cd C:\DiskGenius

euc.exe --list-efi
#15
Put the software in the directory Program Files (x86), I can run successfully Smile

I have encountered a small problem, why the following two type codes, the output of the variable d is different, how to get the full path of the variable d in the code of RunConsole2?

Macro Macro4
Code:
Copy      Help
str d="$Desktop$"

run F"{d}\test.txt" ;;Successful

str s=
F
;{d}\test.txt
out s
__TempFile f.Init(".bat" "" "" s)

RunConsole2 f ;;failed
#16
d.expandpath
#17
Is there any way to display only the run results ,  without displaying the command?  Smile

Macro Macro1
Trigger SF9     Help - how to add the trigger to the macro
Code:
Copy      Help
str s=
;cd C:\Program Files\7-zip
;7z.exe /?
out s
__TempFile f.Init(".bat" "" "" s)
str ss
RunConsole2 f ss "" 0x200
mes ss


Attached Files Image(s)
   
#18
Code:
Copy      Help
str s=
;@echo off
;cd C:\Program Files\7-zip
;7z.exe /?
#19
Thank you very much, I feel that I have too little programming knowledge. Some of my knowledge has been learned before, but I don’t know how to use it. QM has taught me a lot.   Heart
#20
I want to use the command line to set the administrator password. If I generate the exe file from the macro, which method is more secure. Is there a safer way to set a password?  Smile

Macro Macro2
Code:
Copy      Help
str d="$system$"
str pwd="123456"
str s1=
F
;@echo off
;cd {d.expandpath}
;net user administrator {pwd}
out s1

__TempFile f.Init(".bat" "" "" s1)

str ss1
RunConsole2 f ss1
mes ss1

Macro Macro1
Trigger SF9     Help - how to add the trigger to the macro
Code:
Copy      Help
str d="$system$"
str s1=
F
;@echo off
;cd {d.expandpath}
;net user administrator 123456
out s1

__TempFile f.Init(".bat" "" "" s1)

str ss1
RunConsole2 f ss1
mes ss1
#21
Hello, run the following code, can not display the disk list, manually type the command on the command line can display normally, Is there any way to display it? Huh


Macro Macro1
Code:
Copy      Help
str s="$system$"
str s1=
F
;cd {s.expandpath}
;diskpart
;list disk
out s1

__TempFile f.Init(".bat" "" "" s1)

str ss1
RunConsole2 f ss1 "" ;;0x200
mes ss1
#22
this should be what your after


Code:
Copy      Help
str s1=
;list disk

__TempFile f.Init(".bat" "" "" s1)
str ss1
RunConsole2 F"cmd.exe /C  diskpart /s ''{f}''" ss1
mes ss1
#23
You are right, the diskpart command is not the same as other commands, thank you for your help. Heart

I want to use the text output by the diskpart command to help me implement the function of the link below

http://www.quickmacros.com/forum/showthr...p?tid=6601

but for me, the code is difficult to write, I think this is a way to locate the hard disk of the folder. 

List hard disk command: list disk

List volume command: list vol

There may be an easier way Wink
#24
How to implement the message box to automatically close after 5 seconds? Huh
#25
this should be what your after


Code:
Copy      Help
str s1=
;list disk
;list vol
__TempFile f.Init(".bat" "" "" s1)
str ss1
RunConsole2 F"cmd.exe /C  diskpart /s ''{f}''" ss1
MES m
m.style="O";;style is ok button only see qm help for more info
m.timeout=5;;close after 5 seconds
m.default='O';;ok button is default
int i=mes(ss1 "QM Message" m)
#26
Good idea, work very well, thanks Heart


Forum Jump:


Users browsing this thread: 2 Guest(s)