[Solved] Problem getting Batch Files to run as Admin in Win 8.1

I'm trying to control certain Services with batch files to have them stop automatically at start.  However, with certain services, stopping requires run as admin.  My user account has admin privileges.
For example, a batch file with this command will stop with a command prompt requiring Y/N to confirm the stop.
NET STOP "Audiosrv"
I can create a shortcut and set it to run as admin and it will stop the service without issue when it's clicked.  However, if I put the shortcut in the Windows startup folder, so the script runs automatically at boot it seems to ignore the shortcuts.
I've tried the RunAs command below in a batch file, but it doesn't stop the service.
runas /user:jaguar\Admin NET STOP "Audiosrv"
Thanks for your help.

Hello Peter, that works great.   I found I can add multiple arguments by separating them with a semi colon and I could hide the powershell window with the command at the end.
My last question is if there's an additional command that will hide or minimize the command line window when the script runs?
powershell.exe "Start-Process powershell -ArgumentList 'stop-service audiosrv; stop-service AudioEndpointBuilder; stop-service MMCSS' -Verb RunAs" -windowstyle hidden

Similar Messages

  • Problem Executing Batch File

    I wrote out a java class that I tried using cfobject to call. It didn't work. So I wrote a batch file to call the java class.  The batch file works, but NOt when I have coldfusion call it. Nothing happens, no error... nothing.  I thought it might be a permissions issue, but I tried changing permissions for coldfusion although I may have doneit wrong since I'm not too familiar with Vista.  Can anyone offer advice on what I can do.  Its a simple java class and I can't get it to run.  no errors in the log.  There isn't much for me to go on.  All I know is that the class and batch file work fine if Coldfusion doesn't call them.

    Amosl wrote:
    To limit the problems with the class itself and cfobject, I've created a batch file to run the class.  The batch file runs the class fine, so long as I execute the batch via command line.  But coldfusion doesn't execute the batch with cfexecute.  the same exact problem with absolutely no error messages.
    Unfortunately, cfexecute is not the easiest tag to debug. In my experience sometimes it confuses more than clarifies.  But trying it is not a bad idea from a troubleshooting point of view.
    However,  if I create a java class in the same folder that doesn't write to the system and only returns variables, it works fine.  This indicates the class path is set correctly and that cfobject does work.
    Yes, I would agree.
    It does sound like it might be a permissions issue. But I have little experience with Vista, so there may well be another cause.  Since it sounds like you are just testing a very simple java class, can you post the code for the class itself as well as the exact cfexecute code you are using? I could test it on another operating system. Just to see if there is some obvious problem.
    Amosl wrote:
    From the 100's of pages I've read online with people with similar problems, this seems to be a permissions issue.  however, I've set Coldfusion to run as me, the administrator and only person who uses this computer.  It is no longer running as local system.
    However, this didn't fix anything.  My only guess is that perhaps I've no set it to run as me correctly.  But I have no way of testing this.  Windows logs show no error messages either.  Is there any way to have coldfusion show me what user its trying to execute the batch as.
    I believe the user account can be obtained from the java system properties.  Try:
    <cfset sys = createObject("java", "java.lang.System")>
    <cfoutput>
       <b>user.name</b> = #sys.getProperty("user.name", "not found")#<hr>
       <b>coldfusion.classPath</b> = #sys.getProperty("coldfusion.classPath")#<br>
    </cfoutput>

  • How to schedule the Batch file to run from task scheduler

    Hello Everyone,
    I have a batch file which kills the wscript.exe process, I am doing this manually, I need to schedule this batch file to run from task scheduler whenever the process wscript.exe reaches to specific numbers,  i.e if the wscript.exe process count in task
    manager reaches to 30,  the task schedular should execute this batch file,
    Is there a way to do so.
    dibu

    Hi,
    àI need to schedule
    this batch file to run from task scheduler whenever the process wscript.exe reaches to specific numbers.
    As I know, it will not help you to achieve this target via Scheduled Task. When configure Scheduled Task, there
    seems no Trigger option that help you specify this condition (process counts reaches to specific numbers) to trigger the batch file.
    You could consider that improve this batch file. Adding the
    Check function to the script will be a better option. For script issue, you can post it in the
    Official Scripting Guys Forum. I believe we will get a better assistance there.
    If any update, please feel free to let me know.
    Best regards,
    Justin Gu

  • How do I get .aspx files to run on my ipad2

    How do I get .aspx files to run on my ipad2

    aspx files are ASP.NET web pages. You just type the url of the file into your browser's address bar. For example http://theSiteAddress/index.aspx.
    If you mean you want to serve ASP.NET web pages you must be running Microsoft's IIS web server or a server with Microsoft extensions, which you can not do with an iPad. If you mean you want to open an aspx file for editing, these are just text files so use your favorite text editor and open the file for editing.

  • Anyone have problems getting Office 2004 to run after Lion upgrade?

    Anyone have problems getting Office 2004 to run after Lion upgrade?

    For the rare few, such as myself, who have some Office 2004 or older documents that fail to translate well in Office 2011, another option is to run Office 2004 in Snow Leopard (with Rosetta) installed in Parallels:
                             [click on image to enlarge]
    Full Snow Leopard installation instructions are here:
    http://forums.macrumors.com/showthread.php?t=1365439

  • Why Do I get different result when Run as Admin to Standard?

    Why when Running this script to copy from the "config64" folder (if files exist)(if not copy from "config32")  if works correctly when running  Batch file normally (copies the config64), but using the exact same line when running
    the Batch file as "Run as Administrator" it doesn't work correctly (copies the config32, even though Files do exist config64 folder as they did when I ran it normally and it worked)
    >nul 2>nul dir /a-d "Folder\config64\*" /s && (XCOPY "%~dp0Folder\config64\File64.ini" "%ProgramFiles(x86)%\CompanyFolder\ProductFolder\" /y /d) || (XCOPY "%~dp0Folder\config32\File32.ini" "%ProgramFiles(x86)%\CompanyFolder\ProductFolder\" /y /d)
    UAC is turned off and I'm the administrator (only user on a standalone PC) running windows 8.1.
    Is there a reason or it is a strange bug with Windows 8.1?

    A LOT  more intellectual than
    Frederik Long Who just had no clue himself to not offer an answer. As I've only been looking at this for 2 weeks I think I've come far and you help is much appreciated. Thank you JRV!
    You seem to miss the point. Assuming that your problem is caused by a bug can prevent you from finding the real cause. If you had dismissed the bug theory then you might have done some real debugging, e.g. by breaking up your single-line script (which is
    hard to comprehend) into easily digestible pieces and adding some debugging code like so:
    @echo off
    set Target="%ProgramFiles(x86)%\ComapanyFolder\ProductFolder\"
    dir /a-d "Folder\config64\*" /s 1>c:\Test.log 2>&1
    if %ErrorLevel% EQU 0 (
    XCOPY "%~dp0Folder\config64\File64.ini" %Target% /y /d /s 1>>c:\Test.log 2>>&1
    ) else (
    XCOPY "%~dp0Folder\config32\File32.ini" %Target% /y /d /s 1>>c:\Test.log 2>>&1
    The log file would have told you quickly what is going on. Furthermore - why should I offer my own solution to your problem when JRV gave you a perfect answer straight away?

  • [solved] writing systemd service file to run script

    i have completely migrated to systemd. now, i am trying to write a service file to run a startup script (~/.startup.sh). one of the functions of the script is to set the brightness of the screen:
    echo "95" > /sys/class/backlight/intel_backlight/brightness
    i created /etc/systemd/system/startup.service:
    [Unit]
    Description=Run startup script
    [Service]
    Type=oneshot
    ExecStart=~/.startup.sh
    [Install]
    WantedBy=multi-user.target
    but i get the following error:
    Failed to issue method call: Unit startup.service failed to load: Invalid argument. See system logs and 'systemctl status startup.service' for details.
    i have two questions:
    1. what am i missing?
    2. how can i avoid permission issues associated with modifying the brightness file (e.g., permission denied errors, the need to put in the password, etc.)?
    thanks.
    Last edited by anti-destin (2012-08-01 22:26:04)

    thanks for the replies.
    just a note: using an absolute path didn't fix the issue.
    but i went ahead and created the file /etc/tmpfiles.d/backlight.conf:
    w /sys/class/backlight/intel_backlight/brightness - - - - 95
    and that worked.
    is there a reason for recommending using a tmpfile rather than a service?
    in any case, i'm marking this as solved.

  • Batch File to run Java Program

    I'm trying to create a batch file that will run a java program without opening it up, compiling, and executing:
    JAVA.EXE "C:\(path).class"
    It keeps giving me the error message:
    Exception in thread "main" java.lang.NoClassDefFoundError: C:\\(path)/class

    allright... i switched up the batch file to the format
    you gave me. It seems better, but now it has a problem
    with TerminalIO.KeyboardReader. The error message was:
    Exception in thread "main"
    java.lang.NoClassDefFoundError:
    TerminalIO/KeyboardReader
    at util.<clinit>(util.java:18)
    at GPA_Calculator.<clinit>(GPA_Calculator.java:3)
    util line 18 is:
    private static KeyboardReader input = new
    KeyboardReader ();Sounds like you've got alot of non-standard classes there ... I could not begin to speculate. Is this something you wrote or inherited? If it is not too large you could try posting the code ... but it sounds like that would not be practicle. At any rate I can't see how it's working better if it is still not working :S

  • Problem getting simple servlet to run in tomcat

    i am trying to get a servlet to run that is explained in wrox Professional JSP second edition. i am using tomcat as the book explains.
    1. i have created the ch03/WEB-INF/classes directory within the webapps folder in tomcat.
    2. in the classes folder i created the directory
    com/wrox/projsp/ch03/myfirstwebapp.
    3. in the folder myfirstwebapp i have the compiled file
    MyFirstServlet.class
    4. i made sure the code is exactly as in the book.
    5. it states that if i go to
    http://localhost:8080/ch03/servlet/com.wrox.projsp.ch03.myfirstwebapp.MyFirstServlet i should get the correct output.
    6. the only way i can get this to work is if i create a web.xml
    file and point it to
    com.wrox.projsp.ch03.myfirstwebapp.MyFirstServlet and then in the
    browser i type in
    http://localhost:8080/ch03/com.wrox.projsp.ch03.myfirstwebapp.MyFirstServlet thus leaving out /servlet in the URL
    7. this seems fine but i would like to get it to work how the book shows which is without having to use the web.xml. am i missing something? do i need to set up anything (eg. a context tag for this app)within the server.xml.
    any help would greatly be appreciated,
    gary bushek

    I don't know how the book you're using instructed you to setup the server but my web.xml simply has the following in it:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
    </web-app>
    I'm using tomact 3.2 and am able to run my servlets using
    http://localhost/servlet/package_name.servletName
    you might want to checkout www.coreservlets.com for more help on setting up tomcat.

  • Batch file to run daily database backup

    Our company has just started using an Oracle database for a third-party software. I am currently performing a manual daily database backup through the dos command prompt (exp.exe "system_id"\password@"database" parfile=export_parameter.txt). This creates and .dmp and .log file for the database backup.
    Does anyone know of a batch file or another method that I can use to perform an automatic daily backup of my database?
    I would really appreciate your input. Thanks.

    Hi,
    Put your exp command into a .bat file, and schedule it by AT dos command (or WINAT, if you have it).
    hth
    Paolo

  • Batch File not running all commands, MaxL seems to stop them

    I have a batch file that looks like this (removed the part in the middle that does the data extract, this is just for testing)
    E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient-32\bin\startMaxl.cmd "E:\DataExtract\Scripts\MaxL-StartArchive.txt"
    E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient-32\bin\startMaxl.cmd "E:\DataExtract\Scripts\MaxL-StopArchive.txt"
    It executes the first MaxL file find, and then in the command prompt says "MaxL Shell Completed" and goes back to the prompt. It is not picking up the second MaxL script.
    We just upgraded to 11.1.2.1 and this worked fine in 11.1.1.3 when using essmsh. Any idea why it doesn't go through the whole script?
    The contents of the two files are:
    MaxL-StartArchive
    login 'admin' identified by 'removedpassword' on 'servername';
    alter database CSHBud.PandL begin archive to file 'E:\DataExtract\CurrentExtracts\Archive-CSHBud-PandL.txt';
    alter database CSHBud.Wrkforce begin archive to file 'E:\DataExtract\CurrentExtracts\Archive-CSHBud-Wrkforce.txt';
    alter database PropBud.NOIStmt begin archive to file 'E:\DataExtract\CurrentExtracts\Archive-PropBud-NOIStmt.txt';
    alter database PropBud.Staffing begin archive to file 'E:\DataExtract\CurrentExtracts\Archive-PropBud-Staffing.txt';
    logout;
    MaxL-StopArchive
    login 'admin' identified by 'removedpassword' on 'servername';
    alter database CSHBud.PandL end archive;
    alter database CSHBud.Wrkforce end archive;
    alter database PropBud.NOIStmt end archive;
    alter database PropBud.Staffing end archive;
    logout;
    exit;

    >
    E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient-32\bin\startMaxl.cmd "E:\DataExtract\Scripts\MaxL-StartArchive.txt"
    Had this happen at a client that just upgraded
    Try Cmd /C E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient-32\bin\startMaxl.cmd "E:\DataExtract\Scripts\MaxL-StartArchive.txt"

  • Open file need run as admin

    Hello 
    in my code there is simle open file .
    in labview it works without any problem .
    when i creat executable file it can't open file but when i run as admin it works fine .
    here wht i have done :
    1-change built property to run as admin (didn't work).
    2- read/write registry data (didn't work).
    change manifest .
    this is my minifest :
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="NationalInstruments.Installer.MetaInstaller" type="win32"></assemblyIdentity><description>MetaI​nstaller</description><dependency><dependentAssemb​ly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity></dependentAssembl​y></dependency><trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security​><requestedPrivileges><requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel></reque​stedPrivileges></security></trustInfo><compatibili​ty xmlns="urn:schemas-microsoft-com:compatibility.v1"​>
    <application>
    <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supp​ortedOS>
    </application>
    </compatibility></assembly>
    as you see it's 
    <requestedExecutionLevel level="requireAdministrator"
    but still the program doesn't ask run as admin .
    what can i do ?
    Best Regards
    Solved!
    Go to Solution.

    thanks for reply 
    "Where is the file at that you are trying to open?"
    Drive C
    Constant address "C:\PMsetting.bin"
    " What kind of file?"
    binary file 
    "What type of access are you requesting (read, write, read-write)?"
    read and write
    " What error are you getting from the open file function?"
    no  errore just doesn't work !
    here is my vi 
    this vi is called from main vi 
    Attachments:
    Initial_With_State_machine.vi ‏34 KB

  • Get JSP file to run with an applet tag under JDeveloper

    I Created an applet and an html file under JDeveloper. with the applet tag in the html file.
    when I run the html file the applet runs perfectly.
    I Created a jsp file in the same project with the applet and the html file under JDeveloper. I copied and pasted the applet tag from the html file to the jsp file.
    When I try to run the jsp file under JDeveloper I get
    java.io.FileNotFoundExceptions for all of the jar files in the Applet tag ARCHIVE and for the applet tag CODE
    This is the applet tag that I copied and pasted from the html file to the jsp file
    BEGIN:
    <APPLET CODE="myapplet.Applet1" ARCHIVE="jdev-rt.jar,ojsp.jar,ojsputil.jar,oc4j.jar,servlet.jar,ojc.jar" HEIGHT="200" WIDTH="200" ALIGN="bottom">This browser does not appear to support Applets.</APPLET>
    END:
    Here three example of the exceptions that I got BEGIN:
    1.
    java.io.FileNotFoundException: http://139.169.225.224:8988/JspToAppletWS-JspAppletInstantiation-context-root/jdev-rt.jar
    2.
    java.io.FileNotFoundException: http://139.169.225.224:8988/JspToAppletWS-JspAppletInstantiation-context-root/jdev-rt.jar
    3.
    java.lang.ClassNotFoundException: myapplet.Applet1
    Here three example of the exceptions that I got END:
    This is the html file that works BEGIN:
    <HTML>
    <HEAD>
    <TITLE>
    Title
    </TITLE>
    </HEAD>
    <BODY>
    <H2>
    This is sample HTML text.
    </H2>
    <BR>
    <APPLET CODE="myapplet.Applet1" ARCHIVE="jdev-rt.jar,ojsp.jar,ojsputil.jar,oc4j.jar,servlet.jar,ojc.jar" HEIGHT="200" WIDTH="200" ALIGN="bottom">This browser does not appear to support Applets.</APPLET>
    </BODY>
    </HTML>
    This is the html file that works END:
    This is the JSP file that does not work BEGIN:
    <!--%@ page contentType="text/html;charset=windows-1252"%-->
    <%@ page import = "myapplet.Applet1, java.util.Enumeration, java.util.Vector, javax.swing.JFrame, java.lang.*" contentType="text/html;charset=windows-1252"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>
    Hello World
    </title>
    </head>
    <body>
    <h2>
    The current time is:
    </h2>
    <p>
    <%= new java.util.Date() %></p>
    <APPLET CODE="myapplet.Applet1" ARCHIVE="jdev-rt.jar,ojsp.jar,ojsputil.jar,oc4j.jar,servlet.jar,ojc.jar" HEIGHT="200" WIDTH="200" ALIGN="bottom">This browser does not appear to support Applets.</APPLET-->
    </body>
    </html>
    This is the JSP file that does not work END:
    I would like to know what I need to do so that I can run
    the Jsp file under JDeveloper with the applet tag without any exceptions.

    Hi,
    I meet the same problem and can not get a solution from this forum or other forum in internet, either.
    Have you already solved this problem? Can you tell me your solution? thanks in advance.
    Regards

  • Strange......problem with batch file in java

    hi,
    my problem is that i have created one bat file and i want to run that file in java but it is not running properly. the problem is .......
    i have created one bat file named "file1.bat" & content of this file is as follows :-
    [ ag > b.txt]
    (and content of file "ag" is "aaaaaaa" )
    now i am trying to run this bat file in java and want to read this b.txt in which i have redirected the content of file "ag".
    for that i have written the code like this:-file name is "runbf.java"
    import java.awt.*;
    import java.lang.Runtime;
    import java.io.*;
    public class DriveVol
    public static void main(String args[]) throws IOException
    int volumn;
    Runtime r = Runtime.getRuntime();
    r.exec("ss.bat");
    FileInputStream fp;
    fp = new FileInputStream("b.txt");
    flush();
    do
    volumn = fp.read();
    System.out.print((char)volumn);
    }while(volumn != -1);
    fp.close();
    when i am running this programme first it is not displaying the content of b.txt. but when u run this prog twice then only it 'll give the correct ans. what i mean is, i'll explain that stepwise.
    1. as per my prog. -- r.exec("aa.bat") -- this line 'll execute first. so content of ag 'll redirect to file "b.txt"
    2. now i am trying to read the file "b.txt" using FIleInputStream...
    3. but first time it is giving some garbbage value.when i give --c:jdk1.3\bin>java runbf
    4. but the very next moment when again i run that file - c:jdk1.3\bin>java runbf
    it 'll give the correct value.
    5. again when i change the content of file ag(suppose "bbbbbbb"). & try to run "runbf.java" like this-
    -- c:jdk1.3\bin>java runbf --
    6. then it 'll display the value "aaaaaa". now when again i run that file
    it 'll give the correct value "bbbbbb"
    7. so every time i have to run that "runbf.java" twice for printing the correct
    value of file "b.txt"
    so what i think is that, it is not refreshing the data of file "b.txt". after executing this line
    r.exec("aa.bat");
    so is there any method to refresh the data of file "b.txt"??????
    i think u 'll try to understand my problem...
    so please help me to get the ans.......
    thx.........

    pls can anyone hlp............

  • Having problems getting saved files in PS CS3 to show up in folders in Vista - help?

    My sincerest apologies if this has floated across oyur screens before, but I don't seem to be pluggin in the correct set of keywrds to bring it up in the search if it has.
    Here's my dilemma. I just bought a new computer which came preloaded with Vista, and uploaded my old copy of CS3 onto it. The program seems to be working fine, except that when I open a file in Photoshop and edit it, then save it in a new file (as I do for most of my photoshoots, etc), or even when I save it in the orignial folder, the new "saved" file will not show up in the Vista folder. If I go back to Photoshop and open the folder via File>Open, I can access all of my pictures, but to I cannot access them to upload to the internet, email, use in other programs, etc.
    If I go into "Recently Changed Documents" I can find them, but they seem to be in a temp folder in the Adobe folders. But again, if I go back to Adobe, it says they are in the folder I put them in.
    Any ideas what's going on here?
    Thanks so much for any help you can offer,
    Cass

    They are hidden for whatever reason, either you have a permission problem or they are registered incorrectly with Explorer. Open the folder, then check Extras --> Folder Options. Disable the Hide System Files option and then the more generic Hidden Files section a little lower. If that reveals the files, it's time to check the File Types tab in the same panel and see, why it actually thinks your documents are system files. the simplest solution would be to remove the PSD association and then create it new, when you open a file wit6h a double-click. Of course al lthe above assumes that not some security tool or another application is "stealing" your file type associations. If you have such tools, checking their config may already solve the problems.
    Mylenium

Maybe you are looking for