[RESOLVED] how to combine 2 "batch" commands in xp virtual mode
Results 1 to 13 of 13

Thread: [RESOLVED] how to combine 2 "batch" commands in xp virtual mode

  1. #1
    Join Date
    Jun 2000
    Location
    Chicago USA
    Posts
    939

    Resolved [RESOLVED] how to combine 2 "batch" commands in xp virtual mode

    hi all.

    last fall i installed windows 7 with xp running in virtual mode (see here http://discussions.virtualdr.com/sho...-xp-mode).most of the reason for this

    was to be able to run some legacy basic programs (qbasic does not run in 7 but still does in xp) and print to a laser printer.

    this is the batch command i use to run one of these programs:

    QB /RUN C:\DATA\NCR\RECONCIL.BAS

    this is the property window of the desktop shortcut to that command:

    batchcommand_zps513a4d9e.jpg

    the programs run fine. calculates fine. prints fine. everythig is fine. except that once per week or so nothing prints. what i need to do when that happens is to run the following command which i have set up as another desktop batch shortcut:

    net use lpt1: \\virtual_xp\p2035 /persistent:yes

    when i re-run the basic program, everything prints fine again. what i'd like to do is somehow combine these two so that i (or more importantly someone else when i'm not here) would be able to launch a single desktop shorcut that will execute the "net use" command and then launch the qbasic command.

    any thoughts?

    thanks in advance.

  2. #2
    Join Date
    Mar 2009
    Location
    Arkham Asylum, Cell 13
    Posts
    11,686
    Can't you just add the net use command to the RECONCIL.bat?

  3. #3
    Join Date
    Jun 2000
    Location
    Chicago USA
    Posts
    939
    i've tried that but i get the following error after the "net use" line:

    system error 85 has occurred.
    The local device name is already in use.

    i don't know what that means

  4. #4
    Join Date
    Sep 1999
    Location
    Largo, Fl.
    Posts
    22,322
    I would guess that it means the LPT1 is already in use.

    You could maybe add a line in the bat file to kill the use,,,,and then add it back in.

  5. #5
    Join Date
    Apr 2005
    Location
    Maryland, USA
    Posts
    17,806
    You might try redirecting the output of the net use command to NUL:

    net use lpt1: \\virtual_xp\p2035 /persistent:yes>nul
    qb /run c:\data\ncr\reconcil.bas

    If you want everything all on one line, try inserting an ampersand ("&") between the two commands:

    net use lpt1: \\virtual_xp\p2035 /persistent:yes>nul & qb /run c:\data\ncr\reconcil.bas

    Or maybe, like Steve suggested:

    net use /delete lpt1:
    net use lpt1: \\virtual_xp\p2035 /persistent:yes>nul
    qb /run c:\data\ncr\reconcil.bas
    Last edited by SpywareDr; February 5th, 2014 at 12:21 PM.

  6. #6
    Join Date
    Jun 2000
    Location
    Chicago USA
    Posts
    939
    i used the following as the batch file:

    net use /delete lpt1:
    net use lpt1: \\virtual_xp\p2035 /persistent:yes>nul
    qb /run c:\data\ncr\reconcil.bas

    it works. rather, it doesn't not work. i guess i'll only be able to tell if it works if i don't have to reset the printer manually. a week or so will tell me. i'll let you all know.

    thanks again, midknyte, steve and doc

  7. #7
    Join Date
    Apr 2005
    Location
    Maryland, USA
    Posts
    17,806
    You're welcome zeszut.

    If it stops again, you might also try these two commands:

    net stop spooler
    net start spooler

  8. #8
    Join Date
    Jun 2000
    Location
    Chicago USA
    Posts
    939
    thanks

  9. #9
    Join Date
    Apr 2005
    Location
    Maryland, USA
    Posts
    17,806

  10. #10
    Join Date
    Jun 2000
    Location
    Chicago USA
    Posts
    939
    first new day startup & small glitch.

    last night i hibernated the virtual xp and then shut down the 7. this morning, i booted up 7 and then xp. launched the desktop icon and got this:

    net use /delete lpt1:
    lpt1 was deleted successfully.

    net use lpt1: \\virtual_xp\p2035 /persistent:yes>nul
    System error 66 has occurred.

    then the reconcil.bas launched but nothing printed. when i launched the desktop icon a second time, everything was fine.

    i went back and tried something different. i shutdown the virtual xp (instead of hibernate) then relaunched xpvm. this time i got this:

    net use /delete lpt1:
    The network connection could not be found.

    net use lpt1: \\virtual_xp\p2035 /persistent:yes>nul
    System error 66 has occurred.

    then the reconcil.bas launched but nothing printed. again, when i launched the desktop icon a second time, everything was fine.

    any thoughts?

    i could do either at the end of the day - shutdown or hibernate the xp - but i prefer to hibernate it. it's faster and i found that if i shutdown the xp the icons are scrambled when i launch it again.

  11. #11
    Join Date
    Apr 2005
    Location
    Maryland, USA
    Posts
    17,806
    Quote Originally Posted by zeszut View Post

    first new day startup & small glitch.

    last night i hibernated the virtual xp and then shut down the 7. this morning, i booted up 7 and then xp. launched the desktop icon and got this:

    net use /delete lpt1:
    lpt1 was deleted successfully.
    So we know it does work.


    Quote Originally Posted by zeszut View Post

    net use lpt1: \\virtual_xp\p2035 /persistent:yes>nul
    System error 66 has occurred.
    Does this work maybe?

    net use lpt1: \\127.0.0.1\p2035 /persistent:yes


    Quote Originally Posted by zeszut View Post

    i went back and tried something different. i shutdown the virtual xp (instead of hibernate) then relaunched xpvm. this time i got this:

    net use /delete lpt1:
    The network connection could not be found.
    If the connection to LPT1 is not currently active, then yes, you would get that message.


    Quote Originally Posted by zeszut View Post

    then the reconcil.bas launched but nothing printed. again, when i launched the desktop icon a second time, everything was fine.

    any thoughts?
    After reconcil.bas has launched and nothing will print, does stopping and restarting the spooler get it going?

    net stop spooler
    net start spooler


    Quote Originally Posted by zeszut View Post

    i could do either at the end of the day - shutdown or hibernate the xp - but i prefer to hibernate it. it's faster and i found that if i shutdown the xp the icons are scrambled when i launch it again.
    Know what you mean; hate when that happens. Save and Restore Desktop Icon Layout in Windows Vista and XP.

  12. #12
    Join Date
    Jun 2000
    Location
    Chicago USA
    Posts
    939
    thanks, doc. "net use lpt1: \\127.0.0.1\p2035 /persistent:yes" works perfectly. both after shutdown and hibernate.

    and a BIG thanks for the tip on saving and restoring the icon layout in xp!

  13. #13
    Join Date
    Apr 2005
    Location
    Maryland, USA
    Posts
    17,806
    Excellent, and you're more than welcome!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •