Posts: 53
Threads: 18
Joined: Feb 2014
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.
Posts: 1,337
Threads: 61
Joined: Jul 2006
try running through cmd.exe
not tested
int w
run "$system$\cmd.exe" "manage-bde -unlock D: -RecoveryPassword XXX-XXX-XXX" "" "" 0x10800 win ( "" "ConsoleWindowClass" ) w
Posts: 12,087
Threads: 142
Joined: Dec 2002
If want to use RunConsole2, let the macro run as administrator. Look in Properties.
Posts: 53
Threads: 18
Joined: Feb 2014
09-24-2018, 08:31 AM
(This post was last modified: 09-24-2018, 08:44 AM by Valentin .)
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
str s=
cd C:\Windows\SysNative\
manage-bde -status
__TempFile f.Init(".bat" "" "" s)
RunConsole2 f
Thank you for your time.
Posts: 12,087
Threads: 142
Joined: Dec 2002
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
str s=
;C:\WINDOWS\sysnative\manage-bde.exe -status
__TempFile f.Init ( ".bat" "" "" s)
RunConsole2 f
Posts: 53
Threads: 18
Joined: Feb 2014
Posts: 726
Threads: 99
Joined: Mar 2018
[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
Posts: 12,087
Threads: 142
Joined: Dec 2002
Paths containing spaces must be "enclosed".
Posts: 726
Threads: 99
Joined: Mar 2018
11-07-2018, 09:34 PM
(This post was last modified: 11-07-2018, 09:43 PM by win .)
I have encountered an incomprehensible problem
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
Posts: 12,087
Threads: 142
Joined: Dec 2002
I don't have DiskGenus, but I tested with another program and it works.
Macro
Macro100
str s=
F
;cd C:\Program Files\7-zip
;7z.exe /?
out s
__TempFile f.Init ( ".bat" "" "" s)
RunConsole2 f
try also
Macro
Macro100
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}''"
Posts: 726
Threads: 99
Joined: Mar 2018
11-07-2018, 10:08 PM
(This post was last modified: 11-07-2018, 10:16 PM by win .)
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
Posts: 726
Threads: 99
Joined: Mar 2018
@
[b]Gintaras [/b]
how to "enclose"?
I found the generated temporary bat file
Attached Files
Image(s)
Posts: 12,087
Threads: 142
Joined: Dec 2002
Enclose in double quotes like in my last example with RunConsole2.
Posts: 726
Threads: 99
Joined: Mar 2018
11-08-2018, 10:55 PM
(This post was last modified: 11-08-2018, 11:06 PM by win .)
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
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
Posts: 726
Threads: 99
Joined: Mar 2018
Put the software in the directory Program Files (x86), I can run successfully
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
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
Posts: 12,087
Threads: 142
Joined: Dec 2002
Posts: 726
Threads: 99
Joined: Mar 2018
11-09-2018, 01:49 PM
(This post was last modified: 11-09-2018, 01:50 PM by win .)
Is there any way to display only the run results , without displaying the command?
Macro
Macro1
Trigger
SF9
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)
Posts: 12,087
Threads: 142
Joined: Dec 2002
str s=
;@echo off
;cd C:\Program Files\7-zip
;7z.exe /?
Posts: 726
Threads: 99
Joined: Mar 2018
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.
Posts: 726
Threads: 99
Joined: Mar 2018
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?
Macro
Macro2
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
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
Posts: 726
Threads: 99
Joined: Mar 2018
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?
Macro
Macro1
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
Posts: 1,337
Threads: 61
Joined: Jul 2006
11-13-2018, 01:11 AM
(This post was last modified: 11-13-2018, 01:47 AM by Kevin .)
this should be what your after
str s1=
;list disk
__TempFile f.Init ( ".bat" "" "" s1)
str ss1
RunConsole2 F "cmd.exe /C diskpart /s ''{ f}''" ss1
mes ss1
Posts: 726
Threads: 99
Joined: Mar 2018
11-13-2018, 01:50 AM
(This post was last modified: 11-13-2018, 01:53 AM by win .)
You are right, the diskpart command is not the same as other commands, thank you for your help.
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
Posts: 726
Threads: 99
Joined: Mar 2018
How to implement the message box to automatically close after 5 seconds?
Posts: 1,337
Threads: 61
Joined: Jul 2006
11-13-2018, 11:05 PM
(This post was last modified: 11-13-2018, 11:09 PM by Kevin .)
this should be what your after
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)
Posts: 726
Threads: 99
Joined: Mar 2018
Good idea, work very well, thanks