Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I execute a windows command line in the background, without it interacting with the active user?

share|improve this question
1  
Can you specify what you want to do? Do you want to perform a command on the command line in background or do you want to perform the whole command line in background, so it is unvisible from the desktop? –  omnibrain Oct 12 '10 at 6:20
    
i need two cane perform a command on the command line in background or do you want to perform the whole command line in background –  Mohammad AL-Rawabdeh Oct 12 '10 at 6:41
add comment

7 Answers

up vote 2 down vote accepted

Your question is pretty vague, but there is a post on ServerFault which may contain the information you need. The answer there describes how to run a batch file window hidden.

share|improve this answer
add comment

I suspect you mean: Run something in the background and get the command line back immediately with the launched program continuing.

START "" program

Which is the Unix equivalent of

program &
share|improve this answer
add comment

This is a little late but I just ran across this question while searching for the answer myself and I found this:

START /B program

which, on Windows, is the closest to the Linux command:

program &

From the console HELP system:

C:\>HELP START

Starts a separate window to run a specified program or command.

START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
      [/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B]
      [command/program] [parameters]

    "title"     Title to display in window title bar.
    path        Starting directory.
    B           Start application without creating a new window. The
                application has ^C handling ignored. Unless the application
                enables ^C processing, ^Break is the only way to interrupt
                the application.

One problem I saw with it is that you have more than one program writing to the console window, it gets a little confusing and jumbled.

To make it not interact with the user, you can redirect the output to a file:

START /B program > somefile.txt
share|improve this answer
    
I like this answer best because it doesn't open another command window –  wisbucky Jan 3 at 16:17
add comment
START /MIN program 

the above one is pretty closer with its Unix counterpart program &

share|improve this answer
add comment

If you want the command-line program to run without the user even knowing about it, define it as a Windows Service and it will run on a schedule.

share|improve this answer
    
how do you do that? –  barlop Sep 30 '11 at 19:26
    
Alternatively you can make it a scheduled task - Control Panel->Administrative Tools->Scheduled Tasks or use the schtasks command in Windows XP and above (warning: schtasks is complicated). –  ultrasawblade Apr 6 '12 at 19:02
add comment

An example :

start /MIN /B grep -noid include *.c 1>log.txt 2>1&

Starts grep in backgound redirect both stdout && stderr to log.txt

share|improve this answer
    
This answer has already been given multiple times and was explained in great detail. Does your answer contribute anything that has not yet been said? –  Michael K Jan 28 at 14:33
add comment

Window is not multitasking OS so the Unix like background task cannot performed on windows. in Unix we append '&' sign to tell shell to do the task at background.But accurate effect cannot performed by the windows.

share|improve this answer
    
Windows NT is a multitasking/time-sharing/multi-user OS. There are several answers here already giving solutions, so it can be performed in Windows. –  Louis Mar 7 '13 at 7:16
    
This is the first time I see a post like this!) I think you haven't used Windows yet. Maybe you're Unix fan, or developer of unixoids... –  Jet Apr 6 '13 at 15:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.