Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6176485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:06:38+00:00 2026-05-24T00:06:38+00:00

Have this upload script, and it works. But I would like to add a

  • 0

Have this upload script, and it works. But I would like to add a cmd command after the upload has complete. Is this possible? Thank you in advance.

<%@ Page Language=VBScript %>

    <script runat="server">
        Protected Sub Button1_Click(ByVal sender As Object, _
          ByVal e As System.EventArgs)
            If FileUpload1.HasFile Then
                Try
                    FileUpload1.SaveAs("C:\Inetpub\wwwroot\upload\" & _
                       FileUpload1.FileName)
                    Label1.Text = "File name: " & _
                       FileUpload1.PostedFile.FileName & "<br>" & _
                       "File Size: " & _
                       FileUpload1.PostedFile.ContentLength & " kb<br>" & _
                       "Content type: " & _
                       FileUpload1.PostedFile.ContentType
                Catch ex As Exception
                    Label1.Text = "ERROR: " & ex.Message.ToString()
                End Try
            Else
                Label1.Text = "You have not specified a file."
            End If
        End Sub
    </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:06:39+00:00Added an answer on May 24, 2026 at 12:06 am

    Use ProcessStartInfo:

    C#

    public static int ExecuteCommand(string Command, int Timeout)
    {
       int ExitCode;
       ProcessStartInfo ProcessInfo;
       Process Process;
    
       ProcessInfo = new ProcessStartInfo("cmd.exe", "/C " + Command);
       ProcessInfo.CreateNoWindow = true; 
       ProcessInfo.UseShellExecute = false;
       Process = Process.Start(ProcessInfo);
       Process.WaitForExit(Timeout);
       ExitCode = Process.ExitCode;
       Process.Close();
    
       return ExitCode;
    }
    

    VB:

    Public Shared Function ExecuteCommand(Command As String, Timeout As Integer) As Integer
    Dim ExitCode As Integer
    Dim ProcessInfo As ProcessStartInfo
    Dim Process As Process
    
    ProcessInfo = New ProcessStartInfo("cmd.exe", "/C " + Command)
    ProcessInfo.CreateNoWindow = True
    ProcessInfo.UseShellExecute = False
    Process = Process.Start(ProcessInfo)
    Process.WaitForExit(Timeout)
    ExitCode = Process.ExitCode
    Process.Close()
    
    Return ExitCode
    End Function
    

    To use it in your example:

    Put the function outside of your sub (like right above it) and put the following line where you’d like the code to execute.

    ExecuteCommand(“REN C:\Document.rtf YES.rtf”,100)

    You can check the return value (0 for success) to see if it was successful.

    To do without using the command line:

    Change your line that saves to file to the following:

    FileUpload1.SaveAs("C:\Inetpub\wwwroot\upload\" & _
                       "myFile.txt")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this RewriteRule that works too well :-) RewriteRule ^([^/]*)/$ /script.html?id=$1 [L] The
we would like to upload a .zip file in windows mobile to .cgi script
I have this script which works except for one small problem. Basically it gets
I have a question. I have a script that handles file upload, and after
I have a standard file upload script using this script. When the upload is
I would like to upload different types of files pressumably pdfs to a certain
Can anyone see why this would work in FF but not Safari? When I
I have been trying to use an ajax-style file upload component (like the dojox
I have developed a download/upload manager script. When I upload a file via POST
I have an upload script that runs on a windows webserver 2008. The uploads

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.