Prevent Startup Form from Loading using Command Line Arguments

Hi there
I'm developing a VB.NET windows forms application in VS2013.
The application will have 2 ways of being executed, one being by the user manually and the other being automated by the task scheduler.
When executed by the task scheduler, command line arguments will be used so that the application is aware that it is being run automatically and not by a user.
My problem is that I want the startup form to load when run by a user but I don't want it to load when it is run automatically, I just want to execute code.
Is it possible to prevent the startup form from loading by using the commandline arguments from the MyApplication_Startup event?
Cheers

Hi Aureuz,
>>Is it possible to prevent the startup form from loading by using the commandline arguments from the MyApplication_Startup event
It is impossible to accomplish it in the MyApplication_Startup event, we can use Form.Shown event:
#Form.Shown Event
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.shown(v=vs.110).aspx
If we start a form by using the commandline arguments, the count of CommandLineArgs will be above one, if so, use Me.Hide() method to hide this form.
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
Dim args As String() = Environment.GetCommandLineArgs()
If args.Count > 1 Then
Me.Hide()
Else
Me.Show()
End If
End Sub
You can also uncheck "Enable application framework" on the project properties application tab and select your startup object to a module object:
Module Module1
Sub Main()
Dim args As String() = Environment.GetCommandLineArgs()
If args.Count > 1 Then
'Run your background code
Else
Dim f As New Form1
f.ShowDialog()
End If
End Sub
End Module
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Read in file name + path using command line arguments

    Hi guys,
    I am trying to use command line arguments to read in the name of two files. The code below works as long as the files are on the class path.
    public class cmdLineArguments {
         public static void main(String[] args) {
              String xmlFile1 = args[0];
                    String xmlFile2 = args[1];
              System.out.println ("\nXmlFile1: " + args[0] + "\nXmlFile2: " + args[1]);
    }I would like to be able to read files that are not on the class path as well by entering their full path along with their names.
    In other words, It works if I type:
    C:\Documents and Settings\user\workspace\CmdLineArgs\src>java cmdLineArgs file1.xml file2.xmlbut not if I type:
    C:\Documents and Settings\user\workspace\CmdLineArgs\src>java cmdLineArgs c:\Documents and Settings\user\desktop\file1.xml c:\Documents and Settings\user\desktop\file2.xmlWould anyone please explain how I can edit the code to make it work? I guess I could take them both as a String, modify them manually (add a \ to it etc) but is there an easier way to do it? Even a reference to a tutorial, article etc about this would be very much appreciated.
    Also, any idea why a code would compile and run fine in Eclipse but would create an error from command line?
    Thanks a lot.

    You need to learn about cmd.exe which is used to process the command line. The arguments passed to any program is the command line split at white space so your command line arguments of
    c:\Documents and Settings\user\desktop\file1.xml c:\Documents and Settings\user\desktop\file2.xmlis turned into an array of
    "c:\Documents", "and", "Settings\user\desktop\file1.xml", "c:\Documents", "and", "Settings\user\desktop\file2.xml"In other words instead of 2 arguments you actually have 6.
    To get round this the file names need to be quoted
    java cmdLineArgs "c:\Documents and Settings\user\desktop\file1.xml" "c:\Documents and Settings\user\desktop\file2.xml"

  • Preventing Startup Items From Loading

    How do I get the startup items to not load in OS 10.8.5? I've upgraded and now when I press the Shift key after I login to an account it doesn't prevent the startup items from loading. What key(s) do I press to prevent the startup items from loading in Mountain Lion?
    Thanks

    Are you trying to boot into the Safe Mode? If not, why don't you want the startup items to load? More information about what you are trying to do would help.
    Safe Mode - About
    Safe Mode

  • Using Command Line Arguments with JAVA

    Hi,
    we are using an app called ImageMagick to scale and modify images before they are uploaded to a webserver.
    ImageMagick is called from our Objectiv-C app via
    command line.
    is there a way to this in Java?
    Regards
    Eckbert

    So, ur question is not developing a Java application that
    will do the 'image conversion'; but, your message
    conveys that u want to know how to invoke a Java program built by 'imagemagick' that takes command line arguments?
    Am I right?
    If that's the case, u must look into the documentation
    given along with the download'ed piece of software
    for identifying the 'starting point of the program'. i.e., the
    class that contains the 'main' method! And after you
    identify that class [Eg. ImageMagickStart] then you'll
    have to invoke as follows:
    [you must have Java installed in ur system!]
    c:>java ImageMagickStart
    If the program was written intelligently it must print all
    the command-line arguments required by the above
    program by executing the above command, and from that
    you can identify!
    -RK

  • Possible to use command line argument in project file?

    In my CI build process I would like to have a command line argument "customer" that should be used in the project file to include customer related files into the project like this:
    <Content Include="..\customers\%(customer)\*">
      <Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
    </Content>
    Is that possible?

    Hi pkursawe,
    Try to use the Copy task, topy the custom files into the project, then add these files into the ItemGroup, check this blog post:
    How To: Recursively Copy Files Using the <Copy> Task
    The wildcard will help you to add related files into the project.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to extend C:\ Drive from D:\ using Command line.

    Hi Friend,
    Need your help for extend 30 GB from D:\ to C:\ Drive using Diskpart cmd.
    My HDD size : 500,
    C:\ Drive : 70 GB (Want round this drive as 100 GB)
    D:\ Drive : 394 GB (Want to increase form here)
    After rounding C:\ as 100 GB want to create D:\ drive from unallocated volume and need to do this migration in Diskpart or in BAT Command line.
    -Thanks

    It is not possible to take space from one volume and add it to another volume on the same drive by using diskpart.cmd or any other Microsoft built in tool.
    There are some third party tools that can achieve the task you describe.
    Anyways, the first step is to take backup of your disk, especially volume D:
    After backing up your data, you could perform following steps.
    Using diskpart, remove partition D:
    Using diskpart, extend volume C: (extend size=30000)
    Using diskpart create partition in the remaining space (create partition primary)
    Assign drive letter D: to the partition created in previous step
    Format volume d:
    Restore data from backup to volume D:

  • How to open url in acrobat reader using command line

    Hi,
    I need to open file from url using command line, but I'm still getting some error (wrong filename).
    I've tried for example this command:
    AcroRd32.exe http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_parameters.pdf
    Can anyone help me and tell me what's wrong?

    You can't use a URL as parameter for AcroRd32.exe.

  • Go Online on specific network using command line

    i have a remote troubleshooting software that i wrote myself i have added to it the list of all my clients which can have one of the below:public ipsteamviewer accountslogmein hamachiof course, i'm a paid hamachi client, and i have the latest hamachi version installed whenever i want to troubleshoot any client, i just right click on their name, and select remote desktop.. and the my software will automatically connect to the client using the required authentication/application. when the client has hamachi,his network has to be online, for me to be able to access his ip. so what i'm currently doing is: open hamachi, scroll to my client's network, right click, go online, and then back to my software and troubleshoot! (this is a bit time consuming compared to the other solutions) is there any way, i can go online on a specific network in my local hamachi installation? it would be really a great feature, if we can use a command line script, or use command line arguments to launch special events (locally)example:hamachi.exe /online:mynetworkidhamachi.exe /offline:mynetworkid i appreciate any feedback on this, regards,Dan

    Yes, It would be very interesting to have such a feature.E.g., I need to programmatically request Hamachi to GoOnline, because it often goes offline in some circumstances (after computer wakes from sleep mode for example).

  • Can I convert Word 2003 to PDF using Command Line

    Hello All,
    We have a document generation tool which generates documents in Word 2003 format. The document generation is initiated by the user and the process of generating document is on a remote server. The word file is sent back to the user in word format.
    We would like to convert this doc file to PDF/A format. And we would like to do it programatically, may be using command line arguments. Is it possible?
    Realistically, it is not possible that all the users will have Adobe writer installed in their desktops. In this case, it is possible that Adobe writer is installed in a server and the documents can be converted remotely using command lines?
    Your support on this will be very helpful for us.
    Thanks & Regards
    Irfan

    > Can I use Acrobat Pro to convert a Word 2003 doc to PDF using the Windows command line?
    No.

  • Obtaining command line arguments

    Can someone point me at an example of how to obtain command
    line arguments from inside my Flex application? I want to have my
    Flex application perform different tasks when it is launched with
    different command line arguments, for example:
    myApp.exe 1
    myApp.exe 2
    myApp.exe 3
    How is that done in a Flex app?
    TIA,
    Steve

    "plug_in_guy" <[email protected]> wrote in
    message
    news:gnfgf2$ir1$[email protected]..
    > Can someone point me at an example of how to obtain
    command line arguments
    > from
    > inside my Flex application? I want to have my Flex
    application perform
    > different tasks when it is launched with different
    command line arguments,
    > for
    > example:
    >
    > myApp.exe 1
    > myApp.exe 2
    > myApp.exe 3
    >
    > How is that done in a Flex app?
    This may help:
    http://www.davidtucker.net/2008/01/23/air-tip-7-using-command-line-arguments/

  • How do I get LR2 to "load from device" via command line?

    Hi,
    how do I get LR2 to "load from device" via command line?
    I've got XP to load LR2 when a "camera" (and only a camera) is connected but really cool would be if LR2 would also import the pictures.
    cu,
    Michael

    1. Make sure you are using IOS 7.
    2. Make sure your iPad is register in My Support Profile.
    https://supportprofile.apple.com/
    3. Try downloading again; it should be free.

  • How to print a specific page from a given PDF document, using command line, please?

    Hello,
    I need your advise, please. My customer requires to print a specfic page from a pdf document they receive, using command line or 3rd party solution.
    Anything you can advise, please? I have seen AcroRD32.exe options, but can only print the whole document.
    Kind Regards

    Not sure if there are any examples. The Acrobat SDK is a must, but it is best treated as documentation to study rather than examples to copy. The examples only illustrate a tiny fraction of the capabiliies.
    (One other note: the solution must involve the client owning Acrobat; Acrobat is not for server use).

  • How to use command line with acrobat to extract page(s) from pdf file?

    I have adobe acrobat, and have a pdf file with over 500 pages. I need to extract small chunks of pages from it as seperate pdf files. I was hoping I could use command line interface to do this faster.
    Something like:
    acrobat src des start end
    so for example
    adobe file.pdf my_folder 3 5
    Is this possible? There are many chunks and I don't want to manually do it for every chunk. Command line would be much easier...
    Thanks

    I can't find any programs... sorry.
    Can you create one for me please.
    It should at least have these 5 arguments: (well the first one is not neccessary since were not using acrobat anymore...)
    [program] [src path/src file] [destination path/file name] [start page (inclusive)] [end page (inclusive)]
    for example:
    acrobat ./my_file.pdf ./my_folder/chunk1.pdf 3 5
    if start page == end page, then it only extracts that one page.
    So this way I can just stack these comands on a .bat file or something (maybe like 100 commands), then run the bat file, and it will create all the files.
    Thanks for doing this, it is appreciated.

  • Unable to run reports from the unix command line

    hi
    all of a sudden i am unable to run reports ( on App server 10g) either from the unix scripts or from the unix command line. But i can run them from the forms.
    Any one have any idead about this.
    Thank you

    thanks all for replying
    i have set the env variables for the session and it worked. Looks like i have to set the oracle_home and ld_library_path every time ( opening a new putty session) i call sqlldr.
    But in a whole i am trying to run sql loader from the forms. Right now we have Oracle app server 10g which forms 10g version. As oracle app server 10g didnt come with sqlldr, we are copied the sqlldr of database on to app server with different home. after this we can run sqlldr ( on app server ) from unix scripts but not from Forms. Then we opened a qurey with oracle about app server 10g not commig with sqlldr and its remedy . But they said that they dont have specific remedy for that and suggested the same what we did.
    So we came up with java package which does the same funtion as host command and trying to run sqlldr which is on the database( ie replacing the host command in the forms with the database funtion). By using that funtion i am able to run the sqlldr from sql plus but not from forms. I couldnt easily debug it as i wont through any error messages.
    Any one have any idea of this ...
    Thank you

  • Can't prevent unwanted toolbar from loading in Acrobat Pro 9

    I downloaded an evaluation copy of EverMap AutoBookmark plug-in.  I prefer not to automatically open toolbars that I don't use regularly when first opening Acrobat, but I can't keep the AutoBookmark toolbars from loading, even if I uncheck those particular toolbars.  EverMap support claims that it is a problem in Acrobat.  I have also had the same issue with a free plug-in from the Acrobat for Legal Professionals site. Plug-ins work fine, but I can't prevent the toolbars from loading on startup.
    Anyone else experience this issue?

    Sometimes it is simplest to simply enter the Acrobat folder and move the plugins that are a problem. Just copy then to a backup so you can put them back when you need them. I think that the presence or absence of the plugins is all that Acrobat needs.

Maybe you are looking for

  • "Mail link to this page" does not search within my exchange account

    Hello all, When I try to e-mail a web page from within Safari using the "Mail link to this page", I only get to search for e-mail addresses in my MobileMe account. Backtracking by clicking the "back arrow" to see all groups and what I assumed would b

  • Error Playing Movie

    I have a new iphone that I bought and activated in the States. Im now located in China and will be here for a couple of months. When I go to YouTube on the main screen, the iphone takes me there. When I attempt to play any movie I get an error messag

  • Importing from flash

    I just created an animation in flash. I created the main files in Photoshop for my website. Now, I'm told to use Fireworks to create my slices before importing into Dreamweaver. Does anyone know if I can do this and if so, how do I export the flash f

  • Are there LabVIEW programs written for electrophysiology?

    Hi, I'm trying to set-up an electrophysiology experiment, and I need a data aqcuisition program for my patch clamp amplifier.  I've reviewed the existing software applications (pCLAMP, CellWorks, Pulse/Patchmaster), but, since LabView is used fairly

  • FPN : A small clarification

    Dear all, I have set up FPN between CE 7.1 (Producer) and EP 7.0 (Consumer SP 12). Both were having same user store. Now I want to set up another FPN between BI Portal(Producer, EP 7.0 SP16) and EP (Consumer, SP12). But the portals are having differe