nohup runs a process in the background. There is any equivalent for Windows?
You can use the start command to run a process in the background of the command window.
command1 command2 start command3 command4
command2 waits until command1 finish but command4 don't wait that command3 finishes.
and if you need to run independently of the user logged on, you need to start the process as a service and you can use anysrv.exe
You might want to look at windows services. There are some tools you can download to host any process as a windows service. This causes the process to load in the background at windows startup, so provided it doesn't require user interaction you should be able to host it like this.
The tool you're after is called srvany.exe.
The only way, in Windows, that you can have a process started by a user continue running after logoff (i.e. what "nohup" does) is to start it either through a "scheduled task" or as a Windows service. When the user logs off all processes in their logon session will be killed.
If you're game to try the "Scheduled Tasks" method, you'll want to know how to create them programmatically. The Win32_ScheduledJob WMI class can do it. Documentation is provided in detail here: http://www.microsoft.com/technet/scriptcenter/guide/sas_man_rsxs.mspx?mfr=true Basically, you're looking at doing (shamelessly stolen from Microsoft):
Set objService = GetObject("winmgmts:\\.") Set objNewJob = objService.Get("Win32_ScheduledJob") errJobCreated = objNewJob.Create("Program-to-execute.exe", "ugly-formatted-time-string-per-Microsoft-docs",True ,1 OR 4 OR 16, , ,JobID) If Err.Number = 0 Then Wscript.Echo "New Job ID: " & JobID Else Wscript.Echo "An error occurred: " & errJobCreated End If
To grant "joe user" the ability to create scheduled tasks, you'll have to modify the permission on the %SystemRoot%\Tasks folder. See here for some info on that front: http://technet.microsoft.com/en-us/library/cc785125(WS.10).aspx
This all depends on what your ultimate purpose is. You could run a scheduled task with the option to run only if the user is logged on set to DISABLED. You could possibly use psexec from a remote machine. Better yet might be to run the process as a service. Check out this Google search, this other Google search, this thread, and this other thread for some possible leads in your search for a solution. Ultimately it appears that there is no exact equivalent to nohup on a Windows machine.