Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Registry key to make dos progs stay open?

  • 07-08-2001 10:53am
    #1
    Closed Accounts Posts: 3,859 ✭✭✭


    Anytime I run a dos prog on Win2k that doesn't need user input it runs and automatically closes the window so I can't see the result. I don't want to run there from the command prompt so is there a registry entry I can edit to make them stay open??

    .logic.

    "Man that stuff is real fresh."


Comments

  • Registered Users, Registered Users 2 Posts: 1,967 ✭✭✭adnans


    even i know this one, hope it works.

    run command.exe and go to properties. There should be a check field called "Close on exit", uncheck this and it should work like a charm.

    adnans

    "I'd rather be rich than stupid"


  • Closed Accounts Posts: 3,859 ✭✭✭logic1


    Nah no option for that on Win2k.

    .logic.


  • Registered Users, Registered Users 2 Posts: 1,967 ✭✭✭adnans


    must be a win98se thing! (wow, i just got a sudden rush of deja vu) smile.gif

    adnans


    "I'd rather be rich than stupid"


  • Closed Accounts Posts: 37 nucular


    This setting could be found somewhere in the registry but an easy way to do it is to go to view folder options (or equivalent) from explorer
    1) select filetypes
    2) select ms-dos batch file from the list
    3) click edit
    4) select open
    5) click edit and
    6) insert the following string
    "cmd.exe /k "%1" %*"
    this tells Windows to pass the filename to the command interpreter and execute it. /k tells the interpreter to remain alive once the command has been completed (i.e "/k"eep open)

    btw you can't sue me if your computer dies smile.gif

    but it works here for me.


  • Closed Accounts Posts: 3,859 ✭✭✭logic1


    Is that for 2k or 9* because it doesn't seem to be relevant to 2k.

    .logic.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    Create a batch file with the command and put a pause at the end of it?

    Or pipe the output to a file instead?

    The /K option will also work.


  • Closed Accounts Posts: 3,859 ✭✭✭logic1


    Problem solved. Adnan you were right.. I was looking in totally the wrong place wink.gif)

    .logic.


  • Registered Users, Registered Users 2 Posts: 1,967 ✭✭✭adnans


    score!! smile.gif

    adnans

    "I'd rather be rich than stupid"


  • Closed Accounts Posts: 37 nucular


    works on NT

    should work on 2K as the command interpreter has remained pretty much unchanged

    I have 2k at home but I can't check it now.

    I'm not sure where folder options is on 2k but it should be hiding somewhere (actually on NT it is just options). It is also quite likely that Windows has moved the filetype tab for 2k (" to make life easier ")

    If you are not in any rush I will post a method for 2K tomorrow (tonight if I get a chance). It should be reasonably similiar to NT.

    open is the default key called when you double click on an item.

    another option is to use new instead of edit and add an item called "keep Open" or similiar then use the context menu if you want to keep the prompt alive or doubleclick if you don't.

    sorry I can't be more help right now.


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    <font face="Verdana, Arial" size="2">Originally posted by nucular:
    should work on 2K as the command interpreter has remained pretty much unchanged</font>

    Works on W2K. Unchanged? smile.gif I don't think so.

    It's tricky to find in the Windows help screens but they have really done some cool stuff to the cmd program.

    For example. %~1f (I think?) will change to the size of the file specified in %1.



  • Advertisement
  • Closed Accounts Posts: 37 nucular


    <font face="Verdana, Arial" size="2">
    works on NT

    should work on 2K as the command interpreter has remained pretty much unchanged </font>
    wink.gif

    honestly I didn't realise there was many new options available to the interpreter. Could you point me in the direction of a decent reference or is it dig around in the help files. Not that important but good references are always handy just in case.



  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Shouldn't executing it from the command line (rather than windoze) cause it to stay open?

    Otherwise adding a pause at the end (as suggested above) or send it into a loop at the end.

    "Just because I'm evil doesn't mean I'm not nice." - Charlie Fulton


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    It's a pain to find in the help screens, so here it is.


    Additional Forms of the For Command
    If command extensions are enabled, the following additional forms of the for command are supported:

    directories only

    for /D [%% | %]variable in (set) do command [command-parameters]

    If set contains wildcards (* and ?), specifies to match against directory names instead of file names.

    Recursive

    for /R [[drive :]path] [%% | %]variable in (set) do command [command-parameters]

    Walks the directory tree rooted at [drive:]path, executing the for statement in each directory of the tree. If no directory is specified after /R then the current directory is assumed. If set is just a single period (.) character then it will only enumerate the directory tree.

    Iterative

    for /L [%% | %]variable in (start,step,end) do command [command-parameters]

    The set is a sequence of numbers from start to end, by step amount. So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would generate the sequence (5 4 3 2 1).

    File parsing

    for /F ["options"] [%% | %]variable in (filenameset) do command [command-parameters]

    for /F ["options"] [%% | %]variable in ("literal string") do command [command-parameters]

    for /F ["options"] [%% | %]variable in ('command') do command [command-parameters]

    or, if usebackq option present:

    for /F ["options"] [%% | %]variable in (filenameset) do command [command-parameters]

    for /F ["options"] [%% | %]variable in ('literal string') do command [command-parameters]

    for /F ["options"] [%% | %]variable in (`command`) do command [command-parameters]

    The filenameset parameter specifies one or more file names. Each file is opened, read and processed before going on to the next file in filenameset.

    Processing consists of reading in the file, breaking it up into individual lines of text and then parsing each line into zero or more tokens. The body of the for loop is then called with the variable value(s) set to the found token string(s). By default, /F passes the first blank separated token from each line of each file.

    Blank lines are skipped. You can override the default parsing behavior by specifying the optional "options" parameter. This is a quoted string which contains one or more keywords to specify different parsing options. The keywords are:

    Keyword Description
    eol=c specifies an end of line comment character (just one character)
    skip=n specifies the number of lines to skip at the beginning of the file.
    delims=xxx specifies a delimiter set. This replaces the default delimiter set of space and tab.
    tokens=x,y,m-n specifies which tokens from each line are to be passed to the for body for each iteration. This will cause additional variable names to be allocated. The m-n form is a range, specifying the mth through the nth tokens. If the last character in the tokens= string is an asterisk, then an additional variable is allocated and receives the remaining text on the line after the last token parsed.
    usebackq specifies that a back quoted string is executed as a command, a single quoted string is a literal string command, and you can use double quotes to quote file names in filenameset.

    Variable substitution

    In addition, substitution modifiers for for variable references have been enhanced. You can now use the following optional syntax (for any variable I):

    Variable (with modifier) Description
    %~I expands %I which removes any surrounding quotes (")
    %~fI expands %I to a fully qualified path name
    %~dI expands %I to a drive letter only
    %~pI expands %I to a path only
    %~nI expands %I to a file name only
    %~xI expands %I to a file extension only
    %~sI expands path to contain short names only
    %~aI expands %I to the file attributes of file
    %~tI expands %I to the date/time of file
    %~zI expands %I to the size of file
    %~$PATH:I searches the directories listed in the PATH environment variable and expands %I to the fully qualified name of the first one found. If the environment variable name is not defined or the file is not found by the search, then this modifier expands to the empty string.

    The modifiers can be combined to get compound results:

    Variable (with combined modifiers) Description
    %~dpI expands %I to a drive letter and path only
    %~nxI expands %I to a file name and extension only
    %~fsI expands %I to a full path name with short names only
    %~dp$PATH:I searches the directories listed in the PATH environment variable for %I and expands to the drive letter and path of the first one found
    %~ftzaI expands %I to a dir-like output line

    Notes

    In the above examples, %I and PATH can be replaced by other valid values. The %~ syntax is terminated by a valid for variable name.
    Using uppercase variable names such as %I can make your code more readable and avoid confusion with the modifiers, which are not case sensitive.


    [This message has been edited by Hobbes (edited 07-08-2001).]


  • Registered Users, Registered Users 2 Posts: 1,967 ✭✭✭adnans


    its fixed goddamnit!!!

    adnans

    "I'd rather be rich than stupid"

    [This message has been edited by adnans (edited 07-08-2001).]


  • Closed Accounts Posts: 37 nucular


    thanks Hobbes nice 1 smile.gif


Advertisement