VB script to run a batch script as admin

I have batch script the I need to run as an administrator, I created a VBscript wrapper that calls a runas and runs my batch file, however the batch file is not being elevated high enough on Windows 7 and Vista, it works fine on XP.  The batch script
needs to create a folder in Program files, and copy the necessary files, install several programs, as well as make several registry key changes.  If I am logged in as a user with admin rights, right click on the batch file and select "Run as Administrator"
the batch works fine.  Using the VBscript to elevate the rights, it installs the programs, but when it comes to creating the folder in Program files\Program data and Registry edits, it fails.  Is there any way to script so I can elevate the batch
file to the same level as selecting "Run as Administrator?
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("runas /user:domain\user \\unc\location\Install.bat"), 1, True
WScript.Sleep 100
oShell.Sendkeys "password~"
Another issue, I am having with the script is that it will not send the password, I have to type it manually to test.
The idea is to have the end user be able to click on a link from a webpage and install the program itself, as opposed for our Helpdesk be required to install the program.  So psexec is no doable as it is not on any of the PCs and user login scripts
is not an option either, as we don't want the program install on every PC.

Evers_Mark,
Here is a VB Script Vall Script that will get around the Password Prompt when "RunAs" is called...
'Start
' To Run other VB Scripts or even Batch Files with Admin Priviliges'
Dim WshShell, objFSO
suser = "[email protected]"
sPass = "YourPassWord"
'Put your Domain Account and Password in between the qoutes, REMEMBER! the Password will be clear text. If this is a standalone just take off the @YourDomain.com
sCommand = "wscript \\UNCServerName\ShareFolder\YourScript.vbs"
'This will be the path were the scripted you want called will be at. Please note you can substitute the ablove for a local directory (Example: C:\Folder\YourScript.vbs)
Set objComputer = CreateObject("Shell.LocalMachine")
Set WshNetwork = CreateObject("WScript.Network")
Set WshShell = CreatObject("WScript.Shell")
Set WshEnv = wshShell.Environment("Process")
WinPath = WshEnv("SystemRoot")&"\System32\runas.exe"
rc = WshShell.Run ("runas /noprofile /user:" & suser & " " $ Chr(34) & sCommand & Chr(34))
WScript.Sleep 900
WshShell. AppActivate(WinPath)
WScript.quit
'End
I've used this myself to call up scripts with admin rights however I've not tested it with the UAC on in either Vista or 7, However works like a peach with 2000 & XP. From this point you can add in the script into Peagus's disabling the UAC Script as
mentioned below. The usual warnings apply on the security, passwords are sent in plain text.
John M. Keller MCP (XP & 2003) | Security + E-Mail : [email protected]
Sorry but this topic has been closed for almost a year.
If you have a script to share feel free to put it in the repository. (link above).
If you have a new question then please start a new topic.
¯\_(ツ)_/¯

Similar Messages

  • [Resolved][ODQ] Error Running Exported Batch Script Outside of ODI

    Dear ODI experts,
    I have Installed 10.1.3.4.0 ---> selected "Oracle Data Integrator, Oracle Data Profiling, Oracle Data Quality 10.1.3.4.0" ---> Complete (1012MB)
    - follow all steps of "Design a Name and Address Cleansing Project" section in Sample Tutorial
    - in "Oracle DQ User Interface", right click Projects->Quality->customer master[1]
    - select "Run" from the context menu
    - the background tasks completed 100% properly
    - export the project as a Batch Script
    - make changes to config.txt, runProjectN.cmd, and *.stx files following as specified in the Sample Tutorial document
    - at step 13-f, got the following errors by executing runProjectN.cmd
    Wed Nov 28 17:18:37 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e7_us_globrtr_p2.dat>. errno = 2; N
    o such file or directory Occurred in Transformer - (cl_open).
    I did a full search in ODI folders and couldn't find "e7_us_globrtr_p2.dat".
    I tried both export with data and export w/o data with proper change to specify input file path, and got the same error.
    Appreciate any suggestions and/or hints help me further debug of fix this issue.
    Regards,
    Roy
    The following is a complete message echo of runProjectN.cmd
    ===========================================================================
    D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>runproject1.cmd
    D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>set TS_PROJECT=D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1
    D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>set TS_CONFIG=D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts\config.txt
    D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>set TS_SETTINGS=D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings
    D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>set TS_DATA=D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data
    D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>cd /D D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call tranfrmr D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e5_tranfrmr_p1.stx
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call globrtr D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e6_globrtr_p2.stx
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call tranfrmr D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e9_tranfrmr_p3.stx
    Wed Nov 28 17:18:37 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e7_us_globrtr_p2.dat>. errno = 2; N
    o such file or directory Occurred in Transformer - (cl_open).
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call cusparse D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e10_cusparse_p4.stx
    Wed Nov 28 17:18:37 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e9_us_tranfrmr_p3.dat>. errno = 2;
    No such file or directory Occurred in Customer Data Parser - (cl_open).
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call tsqsort D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e11_srtforpm_p5.stx
    Wed Nov 28 17:18:37 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e10_us_cusparse_p4.dat>. errno = 2;
    No such file or directory Occurred in tsqsort - (cl_open).
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call uspmatch D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e12_pmatch_p6.stx
    Wed Nov 28 17:18:37 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e11_us_srtforpm_p5.dat>. errno = 2;
    No such file or directory Occurred in CGeoIO::initGIO - (cl_open).
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call winkey D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e13_winkey_p7.stx
    Wed Nov 28 17:18:38 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e12_us_pmatch_p6.dat>. errno = 2; N
    o such file or directory Occurred in CWKD::initWKD - (cl_open).
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call tsqsort D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e14_srtforrl_p8.stx
    Wed Nov 28 17:18:38 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e13_us_winkey_p7.dat>. errno = 2; N
    o such file or directory Occurred in tsqsort - (cl_open).
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call rellink D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e15_rellink_p9.stx
    Wed Nov 28 17:18:38 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e14_us_srtforrl_p8.dat>. errno = 2;
    No such file or directory Occurred in CMatcher::InitMatcher - (cl_open).
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call common D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e16_common_p10.stx
    Wed Nov 28 17:18:39 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e15_us_rellink_p9.dat>. errno = 2;
    No such file or directory Occurred in Create Common - (cl_open).
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call datarec D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e17_datarec_p11.stx
    Wed Nov 28 17:18:39 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e16_us_common_p10.dat>. errno = 2;
    No such file or directory Occurred in CReCons::initRC - (cl_open).
    D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>
    ===========================================================================
    Solution:
    Needs to modify "e9_tranfrmr_p3.stx" to point to "e6_nomatch_globrtr_p2_us.dat".

    Seems to be the DRM service went down, try running the batch after stopping & restarting the service.

  • How run a batch file from VBS script?

    I have written a script in which I create a batch file that I want to run. Running it from the Start menu with "Run..." works fine but I would like to do it automatically from the script. I can't find a command that works but I am a beginner, so I'm hoping someone's got a solution?!

    Hi again!
    Thank you for your help but I've just discovered that my problem probably doesn't have to do with the way that I call for the batch file. It's more like this:
    The batch file is run but it only does its job some of the times... The batch contains one name of a converter application (Convert.exe) and the names of some databases and files. I've been told that the conversion should work if Convert.exe is located in the same folder as the files. Which it also does, if I run the batch from "Run..." but not from my code.
    I had it working for a while when I had fiddled (as I said, I'm a beginner at this) with setting some drives, such as userDrv and changing some paths in the script settings. Since I didn't really know what I was doing though, I didn't save these settings when closing down DIAdem and now it's not working again. When it worked, it only worked for the file where my .VBS was saved. The point of the program is to convert files in different folders so that wasn't enough.
    Just for clearity: I can't write the name as "C:\My Folder..." because the batch file name and the folder it is situated in is different each time so I have variables for the path and the batch, but that part seems to work. (Call ExtProgram(batFilename_) where batFilename_ includes the path).  
    So I guess what I need to understand is how the different drives work or maybe I need to somehow change my path settings?

  • I want to know how to create a new script that can be run in batch proces in Photoshop Element 11 ?

    I want to know how to create a new script that can be run in batch proces in Photoshop Element 11 ?

    Have a look at the menu file/process multiple files. You can choose to add your signature (or the caption) to the image and export the new files.
    If that solution is not flexible enough, consider using the very affordable (12$)  Elements+ add-on which offers a 'meta stamp' script :
    http://elementsplus.net/v5/en/meta-stamp.htm
    Otherwise, have a look at other free and good solutions like Faststone Photoresizer, Xnview...

  • Running a batch of scripts

    I've got a batch of scripts to run.
    I've run batches of scripts many times but I'm looking for a smarter way of doing it.
    I would like to be able to create a sql script that will run a batch of other scripts - but pass in the connection string.
    At the moment I use a script like this:
    set echo on
    spool cr_run_all
    conn cat1/cat1
    --tables
    @./cr_table_x_cat1.sql
    @./cr_table_y_cat2.sql
    @./cr_table_x_cat1.sql
    @./cr_table_y_cat2.sql
    --indexes
    @./cr_index_x_p_cat1.sql
    @./cr_index_y_p_cat2.sql
    --function
    @./cr_fn_x_cat1.sql
    @./cr_fn_x_cat2.sql
    --procedures
    @./cr_pr_x_cat1.sql
    @./cr_pr_y_cat1.sql
    @./cr_pr_z_cat1.sql
    --packages
    @./cr_pk_x_cat1.sql
    @./cr_pk_x_cat2.sql
    @./cr_pk_y_cat1.sql
    @./cr_pk_y_cat2.sql
    spool off
    exit
    Each script in turn has it's own connect string as the scripts are connecting as different users - cat1 & cat2 - I would like to make each script connect to a particular instance.
    Is it possible to create a sql script to run the other scripts that could pass the connect string for the instance to the scripts?
    This would save me having to put the connect string into each and every script.

    Hi
    You can call connect between scripts:
    @./cr_table_y_cat2.sql
    --indexes
    conn cat2/cat2
    @./cr_index_x_p_cat1.sql
    Or
    conn cat1/cat1
    @./all_script.sql
    conn cat2/cat2
    @./all_script.sql
    Ott Karesz
    http://www.trendo-kft.hu

  • Running a Batch File using Auto Scheduler in HFM?

    Hi,
    Can we execute a batch file or run a macro or execute a VB script using the auto scheduler in Task Automation in HFM??
    Abhishek
    Edited by: user10378700 on Sep 30, 2008 7:18 AM

    I'm having difficulty running a batch script the way you describe.
    One line of code in c:\test.bat:
    echo Hello >c:\test.log
    This works just fine.
    However, for the life of me I cannot get this to work through Task Automation.
    I have the Application as Hub.
    The Action as Execute.
    The Command as c:\test.bat.
    When I select the task and click on Run Now, I get a message that the taskflow has initiated successfully. However, nothing fires on the server. I cannot see this process in Running Tasks (it would run quickly).
    Any hints?
    I have not found this subject to be...overdocumented.
    Regards,
    Cameron Lackpour

  • Running a batch sequence in Acrobat 11

    Hi All:
       I am running a batch sequence in Acrobat 11 on the Mac and as quickly and conciesly as I can, I want to outline the steps in the process:
    1.)  Select the batch sequence to be run.
    2.)  Select the files upon whic to run the batch sequence.
    3.)  Click Start.
    4.)  The text of the script appears on the screen, highlighted.
    5.)  Click OK to close the script editor and run the script on the first file.
    6.) The text of the script appears on the screen, highlighted.
    7.)  Click OK to close the script editor and run the script on the first file.
    8.) The text of the script appears on the screen, highlighted.
    9.)  Click OK to close the script editor and run the script on the first file.
    <continue the last two steps for each document you process>
    If the user has selected thirty documents to process in this sequence run, then she must see the script apear thirty times, and must press the OK button thirty times to actually run the script on the next Acrobat document.  Ditto for sixty and ninety documents.This is cumbersome and tedious not to mentionn dangerous to the script.  Im ny preactice run I accidently tapped teh spacebar and completely wiped the script!.  Is there any way to tell the program to skip displaying the script at the start of each cycle and just move on to the next job?

    Click the commands you added to the Action and make sure that none of them has the "Prompt User" check-box underneath it ticked.

  • Running a Batch by checking File in OpenBatch folder instead of scheduling

    Hi All,
    We have  requirement to run a Batch file whenever it is available in OpenBatch Folder. It is not available at any particular time intervals so we can not schedule it.
    Can this be achieved by using some script in FDM? Or do we need to write some VB script to check the OpenBatch folder for file and then call the batch using Upshell?
    Any inputs are appreciated.
    Thanks in advance.

    that's how it is run on the current (and previous) client sites and the system administrator just enables / disables for the appropriate business days or in some cases they jut leave it polling
    the .net option i played about with was the FilesystemWatcher class, and although it did the job, i took the view that it was an extra bespoke bit of functionality that needed to be managed / monitored and in the end did not really provide any benefits over the task manager. At least with Task manager, it is part of the application and easy to control if there are issues and you wish to stop / start the batch process (especially when testing etc or production problems arise).
    If you do a search on the internet i am sure you will find various examples in different progam languages that may be of assistance to you.    

  • RE: Reporting after many forte tasks run in batch mode?

    Actually, if you're looking for MAKEAPPDISTRIB (I assume that's how you
    create distributable) you can see if the command was succesfull or not.
    <<deployrep.js>> This Jscript will look for this string and it will
    generate a report based on the next line in the log file.
    The script assumes you have an environment variable (DESCARTES_ROOT) that
    points to a folder (let's say "D:\TEST"). Under that folder you have a log
    folder ("d:\test\log") which holds the deploy.log log file. You can easily
    change the script to reflect your systems settings.
    The generated report looks like that : <<deployrep.txt>>
    Norocel Popa
    Forte SysEng
    (519)746-8110 x 2292
    -----Original Message-----
    From: [email protected] [mailto:[email protected]]
    Sent: Tuesday, March 16, 1999 11:58 AM
    To: Forte-Users (Adresse de messagerie)
    Subject: Reporting after many forte tasks run in batch mode ?
    Hi,
    I would like to know if overnight builds went okay, and therefore need to
    parse the log(s).
    The issue is that I don't have a proper string to look for (i.e. for
    grep).
    If I consider 'ERROR", then the following message won't be understandable.
    There might a way to cheat with the indentation (i.e. the lines with only
    two first blank chars)..
    Has anyone experimented such a need ?
    J-Paul Gabrielli
    DTS
    SYSTEM ERROR: Service object MySuperApplicationServer.MySuperMgrSO has
    not been partitioned. Therefore, you cannot move it to an existing
    partition.
    Class: qqsp_UsageException
    Error #: [1602, 606]
    Detected at: qqcf_StandardConfig::MoveServiceObject at 3
    Error Time: Tue Mar 16 17:39:26
    Exception occurred (locally) on partition "Fscript_cl9_Client",
    (partitionId = B84E6180-D639-11D2-82F2-1863030AAA77:0x244:0x1,
    taskId =
    [B84E6180-D639-11D2-82F2-1863030AAA77:0x244:0x1.1]) in application
    "fscript", pid 22713 on node rambo in environment SuperEnv.

    Hi,
    To trap error message from Forte log, I usually do this
    egrep '(EXCEPTION|Exception|exception|ERROR|Error|error)' filename
    This takes a regular expression to 'egrep' all occurrences of "exception" or
    "error" not matter they are in upper case or lower case.
    Hope this help.
    Regards,
    Peter Sham.
    -----Original Message-----
    From: [email protected] [SMTP:[email protected]]
    Sent: Wednesday, March 17, 1999 12:58 AM
    To: Forte-Users (Adresse de messagerie)
    Subject: Reporting after many forte tasks run in
    batch mode ?
    Hi,
    I would like to know if overnight builds went okay, and
    therefore need to parse the log(s).
    The issue is that I don't have a proper string to look for
    (i.e. for grep).
    If I consider 'ERROR", then the following message won't be
    understandable.
    There might a way to cheat with the indentation (i.e. the
    lines with only two first blank chars)..
    Has anyone experimented such a need ?
    J-Paul Gabrielli
    DTS
    SYSTEM ERROR: Service object
    MySuperApplicationServer.MySuperMgrSO has
    not been partitioned. Therefore, you cannot move it to an
    existing partition.
    Class: qqsp_UsageException
    Error #: [1602, 606]
    Detected at: qqcf_StandardConfig::MoveServiceObject at 3
    Error Time: Tue Mar 16 17:39:26
    Exception occurred (locally) on partition
    "Fscript_cl9_Client",
    (partitionId =
    B84E6180-D639-11D2-82F2-1863030AAA77:0x244:0x1, taskId =
    [B84E6180-D639-11D2-82F2-1863030AAA77:0x244:0x1.1]) in
    application
    "fscript", pid 22713 on node rambo in environment
    SuperEnv.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:<a href=
    "http://pinehurst.sageit.com/listarchive/">http://pinehurst.sageit.com/listarchive/</a>>

  • Unable to run a Batch File Operating System Command

    Using XI 3.0, I am unable to run a Batch File Operating System Command After Message Processing.
    My Batch file:
    gpg -se -r BOA3RSKY --armor --passphrase-fd 0 %1 < C:\Progra~1\GNU\GnuPG\gpgin
    My Command Line (ID scenario)
    exec "cmd.exe /c C:\Progra~1\GNU\GnuPG\boagpg.bat %F"
    If I execute
    exec "cmd.exe /c type C:\Progra~1\GNU\GnuPG\boagpg.bat >xis.txt"
    It displays the contents of boagpg.bat file in xis.txt.
    I just don't understand why when I run the batch file, I would expect an %F.asc encrypted file in the same directory as the %F unencrypted file.
    Any ideas?
    or will I need Basis to create commands that will allow me to run GPG from XI Command Line?

    Check this links if its helpful
    http://help.sap.com/saphelp_nw04/helpdata/en/bb/c7423347dc488097ab705f7185c88f/frameset.htm
    /people/sap.user72/blog/2004/01/30/command-line-help-utility
    Check this thread a similar problem
    Process Integration (PI) & SOA Middleware
    Note 841704 - XI File & JDBC Adapter: Operating system command
    http://service.sap.com/sap/support/notes/841704
    Try to see the below links
    /people/michal.krawczyk2/blog/2005/08/17/xi-operation-system-command--error-catching
    OS Command on FTP
    OS command line script - Need help
    FTP - Run OS Command before file processing
    Note: reward points if solution found helpfull
    Regards
    Chandrakanth.k

  • Trying to run a batch file in ODI and the file is on a windows network drive.

    Hi,
    I'm trying to run a batch file that is located on a windows shared drive for the ODI server. When I try to run the file through OS command by giving the file path in the "command line". I get the error "
    ODI-1226: Step fails after 1 attempt(s).
    ODI-1242: Operating system command execution fails."
    Please let me know if this can be done.

    Hi,
    First try to execute your batch file, if it is executing as expected.
    Then use OdiOSCommand tool and give full path of script and also give a path to create error file & out file.
    Execute the batch now via OdiOSCommand, if it fails then you will receive error message in Error file.
    Also check if you have rights to script being executed via ODI.
    Thanks,
    DK

  • How to run a batch file in a continous loop

    Hi.  PS noob.  I need to run a batch file frequently -- possibly every one minute.  Correct me if I'm wrong, but Task Scheduler can only schedule a task to run as frequently as every 5 minutes.  What would a PS script look like that would
    run a batch file, sleep for a minute or two, then loop?  Thanks.

    Hi District,
    I‘m writing to check if the suggestions were helpful, if you have any questions, please feel free to let me know.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How to run a batch before window log off

    We have a situation. We monitor an application very closely for failure rate. Many users are currently just logging off windows when leaving work. When they use windows log off it kills this application which intern return non-zero exit code(indicating application
    problem). 
    Is there a way to run a batch/powershell script to close application first(we have a method to close it gracefully) before log off process is triggered by windows 7.
    We tried putting a routine in GPO log off script. But widows log off kills all applications before the routine has chance to run.
    Please help.

    Hi,
    Create a batch file and insert the shutdown command in the last line. When you want to shutdown computer, just run this batch file.
    Alex Zhao
    TechNet Community Support

  • Running a batch file - VERY URGENT .. help

    Hi people
    I am attempting to run a batch file from with a JSP page.
    the code i am using is:
    Runtime runtime = Runtime.getRuntime();
    Process process = runtime.exec("cmd.exe /c d:\\uploadfiles.bat");
    This jsp file is located on the c: of a webserver.
    the uploadfiles.bat is located on the d: of the webserver and the code is:
    copy d:\videos\008214?.rm d:\blah
    copy d:\images\008214.* d:\blah
    copy d:\xml\008214.* d:\blah
    cd \blah
    pkzip -es -m 008214.zip *.*
    copy 008214.zip d:\upload\008214.zip
    del 008214.zip
    If I run this batch file from a command line, it works fine, though when I try and call it through my JSP page, it doesnt do anything .. a command window just pops up for a while, and then closes.
    How can I fix this ... I need this quite quickly
    Thanks people

    1) It is O.K. that you see nothing in that console. Its output is captured by Java and is not displayed on the screen.
    In general, that console should not be visible, but actually it behaves differently according to JDK and OS versions (treat that as a feature).
    2). Look at this article:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    It it does not answer your problem, try to search the forums:
    http://search.java.sun.com/search/java/index.jsp?qp=%2Bforum%3A31&nh=10&qt=%2B%22exec%22+-%22Replies%3A+0%22&col=javaforums
    Questions about Runtime.exec() has been asked hundreds of times.
    3) runtime.exec() can execute BAT files. It is not necessary to specify that "cmd /C".

  • Running multiple batch actions on the same folder? One Click?

    We run Actions on a group of images using CS4 with the File->Automate->Batch function. We use this to take, for example, 200 images from a set folder and run an "Action" to create a rendered 2D design and save it in a different location to the source image and add an extension to the file name, leaving the source image unaltered. 
    The problem is that we then require to run this 20 times, each time, the difference is :- we want it to save to a different location and the "action" used is different because it changes the colour for example.
    The desired output is:
    FROM A JPEG ---> 20 folders (named as 20 different colours) and all our images rendered (as in our action) and saved into the 20 folders
    So we have 20 versions of each image
    Currently we simply set off the different actions in a batch separately, IE. 20 lots of batches to set off.
    So for example:
    * We have 200 jpeg images in folder [A]
    * We run a Batch function to run an "action" on all 200 images in folder [A] to render into our design and add a blue colour overlay (this is all done in the action itself) and to save them to folder [B] with the extension (BLUE) added to the filename.
    * Once Photoshop finishes running this Action on the 200 images (wish it would beep or something to let you know it was finished) we then run a batch to run a different "action" on the same 200 images in folder [A] to render the design and add a pink overlay and to save them in folder [C] with the extension (PINK) added to the filename
    And so on and so forth for the 20 different actions.
    Is there a way we can instruct Photoshop to run all of these 20 actions (one after the other in a queue as it where) without having to "Babysit" Photoshop and ask it to run each one off ourselves manually?
    Would we have to use JavaScript for this? We have no experience with JavaScript at all.
    We are currently using Photoshop CS4, is there a easier way to do this on CS5 or CS6?
    Kind Regards and Thanks in advance
    Steven

    Would we have to use JavaScript for this?
    I think it would be advisable but (if you don’t mind risking getting less help) you could use VB or AppleScript depending on your platform.

Maybe you are looking for