Sponsored Content
Special Forums Windows & DOS: Issues & Discussions "background processes" in Windows Post 302912881 by Corona688 on Tuesday 12th of August 2014 12:03:37 PM
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?
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
HWND(3TK)						       Tk Library Procedures							 HWND(3TK)

__________________________________________________________________________________________________________________________________________________

NAME
Tk_GetHWND, Tk_AttachHWND - manage interactione between the Windows handle and an X window SYNOPSIS
#include <tkPlatDecls.h> HWND Tk_GetHWND(window) Window Tk_AttachHWND(tkwin, hwnd) ARGUMENTS
Window window (in) X token for window. Tk_Window tkwin (in) Tk window for window. HWND hwnd (in) Windows HWND for window. _________________________________________________________________ DESCRIPTION
Tk_GetHWND returns the Windows HWND identifier for X Windows window given by window. Tk_AttachHWND binds the Windows HWND identifier to the specified Tk_Window given by tkwin. It returns an X Windows window that encapsulates the HWND. KEYWORDS
identifier, window ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWTk | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for Tk is available on http://opensolaris.org. Tk 8.0 HWND(3TK)
All times are GMT -4. The time now is 01:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy