Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

Visual basic code to replace a batch

I need an .exe application who do the following things for me.

I'm doing those things using a batch file, but I need an exe to do this:

xcopy 1 c:\ /E
xcopy 2 c:\ /E
REGEDIT /S x.REG
REGEDIT /S sshkey.REG

Please if you can help me to do this in visual basic.

Thanks
0
angel12345
Asked:
angel12345
1 Solution
 
SStoryCommented:
to copy the directories, in vb.net 2005, do something like this:

        my.Computer.FileSystem.CopyDirectory(<sourcedir>,<destdir>)

obviously replace <sourcedir> and <destdir> with valid directory paths (don't use the < and >)

as for regedit you could use a process to do this:
        Dim p As New System.Diagnostics.Process()
        p.Start("c:\windows\system32\regedit.exe", "x.reg")

        this assumes that x.reg is in the same subdirectory as this executable, otherwise you'd need to provide a path If you just want to change registry keys, you might want to use

            My.Computer.Registry.SetValue()

'online help can tell you the args to pass to this.

I'm not sure why this would be better than a batch file.

HTH,

Shane
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Tackle projects and never again get stuck behind a technical roadblock.
Join Now