"background processes" in Windows


 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions "background processes" in Windows
# 1  
Old 08-12-2014
"background processes" in Windows

In order to prevent my Windows machine from trying to start umpteen different applications simultaneously and thrashing to oblivion, I have written this script:

Code:
#!/bin/sh

TODAYFILE="$USERPROFILE/My Documents/$(date +%b%d-%Y.txt)"

[ -e "$TODAYFILE" ] ||
        touch "$TODAYFILE"

# ( notepad.exe "$TODAYFILE" ) &

cd "$USERPROFILE/Start Menu/Programs/Delayed-Start" || exit 1

set -- *.*

while [ "$#" -gt 0 ]
do
        printf "Starting %30s\r" "$1"
        case "$1" in
        *.[sS][hH])
                sh ./"$1" &
                ;;
        *)
                cmd /C "$1" &
                [ -z "$2" ] || sleep 45
                ;;
        esac

        shift
done

echo Done

It is executed by a batch file in my 'Startup' items (and Busybox's help.). It looks for script files, lnk files, or anything else inside my own 'Delayed Start' menu and waits 45 seconds between starting each application, in alphabetical order. I name them 1-firstapp 2-secondapp etc to determine the order.

You will notice one commented out line:
Code:
# ( notepad.exe "$TODAYFILE" ) &

This is because Notepad, unlike most "big" apps, doesn't put itself into the background -- and I can't force it to do so, even with & and a subshell. I guess this is something Windows must do, not something a mere script has power over.

How can I convince Windows to do this?
# 2  
Old 08-12-2014
Use "start ..." or "start /B ..." from a batch file?
This User Gave Thanks to achenle For This Post:
# 3  
Old 08-12-2014
Thanks, cmd /C "start /B ..." does the trick.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Shell Programming and Scripting

[SOLVED] Using "$!" to get the PID of the Last Ran Background Process

Hello All, I was looking into creating a script that would be used only to start a Daemon and create a lock file... F.Y.I. It's for Nagios' NRPE Daemon Plugin... Anyway when I run the command to start the Daemon (below): /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d And... (14 Replies)
Discussion started by: mrm5102
14 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Windows & DOS: Issues & Discussions

"Striping" the background of an Rxvt/Urxvt window in Cygwin

To get this: https://www.unix.com/members/silversleevesx-albums-incidental-shot-glass-picture127-termshot-rxvt-rootless.png out of Cygwin's rxvt, you have to tweak your /cygwin/etc/x11/app-defaults/rxvt file, which is here:... (0 Replies)
Discussion started by: SilversleevesX
0 Replies

7. Windows & DOS: Issues & Discussions

Unix "cut' and "awk" in Windows XP?

Hi, How can I execute Unix's ksh equivalent of "cut' and "awk" in Windows XP? For example, I want to execute ksh commands from Windows command prompt. Is there a place I can download "cut.exe" and "awk.exe" ? Thanks in advance (4 Replies)
Discussion started by: ihot
4 Replies

8. Shell Programming and Scripting

How to include RETURN KEY with Background process "&" in Shell Script

Hello All, I am a newbie in Shell script programming, and maybe you can help me with my query. I need to write a shell script (mntServer.ksh) that will start a background process and also to be able to run another script. The mntServer.ksh script contains: #!/bin/ksh... (1 Reply)
Discussion started by: racbern
1 Replies

9. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
Login or Register to Ask a Question