Page 1 of 1

Use MS-DOS Commands in PB ???

Posted: Thu May 21, 2009 4:59 pm
by Tomi
Use MS-DOS Commands in PB ???

for example 'Ver' for display version of OS in concole.
Image

Posted: Thu May 21, 2009 5:13 pm
by SCRJ
Try this :D

Code: Select all

ImportC "msvcrt.lib" 
  system(str.p-ascii) 
EndImport 

OpenConsole() 

system("ver")
Input()

[Edit]
Not sure if the import is correct, but it seems to work.

Posted: Thu May 21, 2009 5:31 pm
by Tomi
Thanks :D it's work
if i want to use multiple command as serial into same console for callbacks too, is possible?

'Ver' next 'cmd' next 'D:' next etc...

Posted: Thu May 21, 2009 6:19 pm
by Kaeru Gaman
why don't you write a batch and start it via RunProgram?

... anyhow, what should this be good for?

there is nothing possible via DOS-commands that could not be done better via API...

DOS-commands are old and obsolete API...

Posted: Thu May 21, 2009 7:00 pm
by Tomi
You're rigth really
I see a nice code for hide and show drive by dos-commands and i deside to run it in pb if it is possible.

please test this:
1-run-->cmd
2-Diskpart
3-List Volume
4-Select Volume n --> n=number of drive-letter
5-Remove Letter l --> l=Letter of drive-letter "Hide"
6-Assign Letter l --> l=Letter of drive-letter "Show"


tested on xp only
vista?
7?
...

Posted: Thu May 21, 2009 7:35 pm
by Kaeru Gaman
these are no "DOS commands"... Image

http://www.microsoft.com/resources/docu ... x?mfr=true

DISKPART ist a commandline program and is also scriptable.

so, the "correct" way would be to write a script for DISKPART,
and run "diskpart.exe" via RunProgram with the script's filename as parameter.

there should be also a way to hide a partition via API directly,
because somehow DISKPART itself accesses this OS-functionality.

additionally, this is playful messin'round with internals, you know that.
only nice to know and for fun, without any useful application.

Posted: Thu May 21, 2009 9:31 pm
by netmaestro
RunProgram + Diskpart = "wha? wha hoppen? wheresallmastuff!!??" :D

Posted: Fri May 22, 2009 5:22 am
by Tomi
OK
i'm an gauche programmer only :D
when i see this commandsline, i need test on PB, because i dont know about commands ,but must be know!
ThanksImage
if it's an example with this explanation, Please me

Posted: Fri May 22, 2009 11:53 am
by Kaeru Gaman
for DOS-commands:

take a look at SCRJ's code... or write a batch script and call it.


for DISKPART:

better leave it alone.

Posted: Fri May 22, 2009 1:23 pm
by Tomi
Thanks Kaeru Gaman
I try this