Use MS-DOS Commands in PB ???

Just starting out? Need help? Post your questions and find answers here.
User avatar
Tomi
Enthusiast
Enthusiast
Posts: 270
Joined: Wed Sep 03, 2008 9:29 am

Use MS-DOS Commands in PB ???

Post by Tomi »

Use MS-DOS Commands in PB ???

for example 'Ver' for display version of OS in concole.
Image
SCRJ
User
User
Posts: 93
Joined: Sun Jan 15, 2006 1:36 pm

Post 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.
User avatar
Tomi
Enthusiast
Enthusiast
Posts: 270
Joined: Wed Sep 03, 2008 9:29 am

Post 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...
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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...
oh... and have a nice day.
User avatar
Tomi
Enthusiast
Enthusiast
Posts: 270
Joined: Wed Sep 03, 2008 9:29 am

Post 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?
...
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

RunProgram + Diskpart = "wha? wha hoppen? wheresallmastuff!!??" :D
BERESHEIT
User avatar
Tomi
Enthusiast
Enthusiast
Posts: 270
Joined: Wed Sep 03, 2008 9:29 am

Post 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
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
User avatar
Tomi
Enthusiast
Enthusiast
Posts: 270
Joined: Wed Sep 03, 2008 9:29 am

Post by Tomi »

Thanks Kaeru Gaman
I try this
Post Reply