help with cmd commands ported to c# OR vb.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NightsEvil
    New Member
    • May 2010
    • 2

    help with cmd commands ported to c# OR vb.net

    hey im new here and new to vb.net or c# iv worked alot in batch scripting and i LOVE how this peice if code works... but cant get it to work in vb.net ... i remarked above each line to explain what each line does.. help me plz i have ALOT of programs that run this way... and id love to have a VB.net exe that does it insted of a batch... if i need something like to make a temp directory some where then have it delete there ... it would be fine such as .. create temp dir under default user app dad named "temp" in which thats where things would be extracted to thats fine (multiple archives are needed to extract to either the environment variable TMP or TEMP then deleted when they're done running with args) these are all sfx exe's created by 7-zip

    Code:
    ::Extracts to the environment variable for TEMP directory
    start /wait Programs\Optimize\AusLogics_Defrag.exe -o%TMP% -y -Pthisisthepass
    ::Runs the exe with command line arguments
    %TMP%\AusLogics_Defrag\cdefrag.exe -dt -o c:
    ::Once its done it deletes the extracted folder and its contents
    IF EXIST "%TMP%\Auslogics_Defrag\" (RMDIR /S /Q "%TMP%\Auslogics_Defrag\")
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    So you need to start an exectuable called AusLogistics, using some arguments, one of which is an environment variable.
    Check out the Process class for starting an executable, and the Environment class for access to the varriables.
    Then you can use the Directory or DirectoryInfo class to handle the removing. (I recomend Directory.Exist s() and Directory.Delet e() for that)

    Comment

    Working...