ok so i have set commands which i normally use with cmd.exe but i need to create gui so its easier based off clicking a button and it would process the entire command for me but still have selection with VB if anyone could show me the the conversion of the current bat file as i have many to port i ony need one to see an example please

@echo off
set /p pkgpacked=Input name of PKG that you want to exctract (without extension):  
cd tools
PkgView.exe -ex ../"%pkgpacked%.pkg"
cd..
del /q %pkgpacked%\*.*
cls
xcopy /s %pkgpacked%\*.* .
cls
dir /b "%pkgpacked%\*." >psp.txt
set /p pkgdir=<"psp.txt"
cls
SET /P ANSWER=Do you want to move EBOOT.PBP from extracted pkg to PSP2PS3 dir (Y/N) 
if /i {%ANSWER%}=={y} (goto :yes)
if /i {%ANSWER%}=={yes} (goto :yes)
if /i {%ANSWER%}=={n} (goto :no)
if /i {%ANSWER%}=={no} (goto :no)
:yes
copy "%pkgpacked%\%pkgdir%\USRDIR\CONTENT\EBOOT.PBP" .
rd /s /q "%pkgpacked%"
cd tools
popup.vbs "Done! Package %pkgpacked%.pkg exctracted to %pkgdir% and EBOOT.PBP moved to PSP2PS3 dir"
cd..
del /q psp.txt
exit
:no
rd /s /q "%pkgpacked%"
cd tools
popup.vbs "Done! Package exctracted to %pkgdir"
cd..
del /q psp.txt

Recommended Answers

All 5 Replies

With the Process Class. You can run 'cmd' with the .bat file as a parameter.

Also, you can redirect the standard input of 'cmd', with the process class, then read the the .bat file line by a line and send each line to 'cmd'.

Alternatively, it looks like everything your batch files is doing can be done with System.IO and/or the process class, and skip using 'cmd' altogether.

There are probably more options, a lot will depend an whether you want a quick patch or a total re-write. If all your batch files follow the same pattern then a total re-write that reads the batch files and performs the relevant actions, is probably your best bet. If there are many differences, running them directly from your app might be better.

I can deal with running the bat files from gui since i have so many to the compiler but im getting a issue with VS 2012 Microsoft.VisualBasic.PowerPacks.Vs. Version=10.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a

What kind of issue?

Creating a stand alone exe so users may choose there own directory but not install
Also when I call shell("cmd.exe" \c) how can I send commands with out causing multiple command windows opening

In my first post I inserted the link to the process class. It covers how to call other apps and send parameters to them, and if need be even redirect the standard input so that input comes from you app not the keyboard. You can even run other apps without a window opening up.

Also the toolbox in VS contains a folderbrowserdialog control where the user can the directory.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.