Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to write multi-line CMD code to run in QM?
#1
How to write multi-line CMD code to run in QM? , For example, the following lines of code, I used to write the original batch, which already exist in. BAT document! Now want to write to the QM, although you can use the Run * .bat way to achieve, but need. BAT file, so want to merge into the QM file, hoping to get everyone's advice! Happy Christmas to all my friends! Thank you very much Big Grin

Del / f / s / q% systemdrive% \ *. Tmp
Del / f / s / q% systemdrive% \ * ._ mp
Del / f / s / q% systemdrive% \ *. Gid
Del / f / s / q% systemdrive% \ *. Chk
Del / f / s / q% systemdrive% \ *. Old
Del / f / s / q% windir% \ *. Bak
Del / f / s / q% windir% \ temp \ *. *
Del / f / a / q% systemdrive% \ *. Sqm
Del / f / s / q% windir% \ SoftwareDistribution \ Download \ *. *
Del / f / s / q "% userprofile% \ cookies \ *. *"
Del / f / s / q "% userprofile% \ recent \ *. *"
Del / f / s / q "% userprofile% \ local settings \ temporary internet files \ *. *"
Del / f / s / q "% userprofile% \ local settings \ temp \ *. *"
#2
The above code has changed, the original code as below


Attached Files Image(s)
   
#3
Code:
Copy      Help
RunConsole2 "cmd.exe /?"

Macro RunConsole cmd.exe, multiple commands
Code:
Copy      Help
str s=
;cd C:\
;dir
s.findreplace("[]" " && ")
RunConsole2 F"cmd.exe /C ''{s}''"

But I don't know what to do with " and other special characters.
#4
Thank you very much for reminding me that I tried using the pscmd method (with pscmd in front of each CMD command), but there was an error during debugging, as in the following image!

I hope that QM can have the simplest way to run multi-line CMD command, because in my usual work, learning, there are many existing. Bat files, but I do not want to use (run * .bat) method, because it requires reference A lot of documents, inconvenient, I have the above method, but also a little trouble, because in order to manually add each line before CMD pscmd, if the original code can be copied to QM CMD, can be achieved, it would be great!

Sincerely hope that you can help solve it, this will give me a great help to work, thanks again :wink:


Attached Files Image(s)
   

.qml   pscmd.qml (Size: 3 KB / Downloads: 329)
#5
Use your method (runconsole2), because just learning QM, it is not too understand, put the code directly to the (S =) behind, debugging, the following picture appears wrong, I hope you can help look at, thank you very much


Attached Files Image(s)
   

.qml   runconsole2.qml (Size: 3 KB / Downloads: 332)
#6
The reason to use the existing CMD command, because in some cases, the use of CMD will be more efficient, although the code can be achieved in the QM to write, but not convenient, such as the above example of the CMD command, I I hope you can consider the actual needs, thank you!
#7
Better use a temporary .bat file.

Macro Macro2758
Code:
Copy      Help
str s=
;Del / f / s / q% systemdrive% \ *. Tmp
;Del / f / s / q% systemdrive% \ * ._ mp
;Del / f / s / q% systemdrive% \ *. Gid
;Del / f / s / q% systemdrive% \ *. Chk
;Del / f / s / q% systemdrive% \ *. Old
;Del / f / s / q% windir% \ *. Bak
;Del / f / s / q% windir% \ temp \ *. *
;Del / f / a / q% systemdrive% \ *. Sqm
;Del / f / s / q% windir% \ SoftwareDistribution \ Download \ *. *
;Del / f / s / q "% userprofile% \ cookies \ *. *"
;Del / f / s / q "% userprofile% \ recent \ *. *"
;Del / f / s / q "% userprofile% \ local settings \ temporary internet files \ *. *"
;Del / f / s / q "% userprofile% \ local settings \ temp \ *. *"

__TempFile f.Init(".bat" "" "" s)
RunConsole2 f
#8
Great, the perfect solution to my problem, thank you very much Gintaras! Wishing you a Merry Christmas! Big Grin Big Grin Big Grin


Forum Jump:


Users browsing this thread: 1 Guest(s)