External task -  run batch file as administrator

Hi,
My name is Sid. I am working on developing an EDQ project to parse a collection of log files.
I have run into a roadblock on the first step!
My EDQ server is on a Windows Server 2008 platform.
I am calling a batch file that copies these log files between two locations.
The batch file copies the files fine when i run it as administrator from the commandarea in  EDQ server, but it does not work when called from the External Tasks in EDQ.
I tried using the runas user:/Administrator in the batch file but that does not work either.
Would greatly appreciate any pointers in this regard.
Thank You,
Sid

With runas you in fact logon to another seesion. So cmd is started with his own starting directory (being where it is located, system32).
I would recommend never to rely on the working dir for a batch file or script, but to always include the full path to the needed command/executables. If needed you can use environment variables to get the pathes of user-customised folders (for example the %usersprofile% variable).
Using .lnk files (normal shortcuts) you can specify the working dir to start in if you would really need that functionality.
MCSA/MCTS/MCP

Similar Messages

  • Running .bat files as administrator on win 7 and win 2k8 machines

    I have .bat which will be copied onto Win 7 and Win 2k8 machines remotely. The batch file contains scripts to stop and restart Windows services, like,
    net stop "Adobe Acrobat Update Service".
    Now when I run this batch file, I get "System error 5 has occurred. Access is denied."
    I understand that I need to run this batch file as administrator (here by administrator I mean, Windows default administrator.).
    Does anyone have a solution for this?
    P.S: 1) "run as" command inside the .bat file won't work, since you need to run the .bat file itself as administrator (here by administrator I mean, Windows default administrator.).
    2) I can create another batch file (say b.bat) containing the "run as" command and invoking the the original batch file (say a.bat), which has the command net stop "Adobe Acrobat Update Service". But still, this won't solve the issue, since you can run as,
    the user, who has administrator privileges and not run as administrator (here by administrator I mean, Windows default administrator.) itself.

    Suhas,
    Can you explain me why you want to do this?
    Maby there are there some beter ways to achive your goal.
    The reason why this doesn't work is UAC who strips the administrator tokens from your user account.
    So it is not nesseary to use the default windows administrator account. Just a user with administrative priviliges will do you only need to run this command elevated.
    There are several ways to run this command elevated:
    Just right click on the batch file and choose the option run as administator.
    Quite simple but a no go if you wanna have a fully automated solution
    Use PsExec.exe  from the pstools suite (avaible
    here)
    If you use the command like this:
    PSEXEC -u domain\user -p password -h net stop spooler
    PSEXEC -u domain\user -p password -h net start spooler
    Or from a remote machine (pcX = remote management machine, pcY = machine where you want to restart the service.)
    Execute this command on machine pcX:
    PSEXEC \\pcY -u domain\user -p password -h net stop spooler
    PSEXEC \\pcY -u domain\user -p password -h net start spooler
    Create a sheduled task with the "highest privlilges" that executes your batch file.
    etc ...
    Kind Regards
    DFT
    IM me - TWiTTer: @DFTER

  • HOST IN 10g to run batch file on application server

    Hi,
    I am trying to deploy a form from 6i to 9i. the form use Host builtin to run batch file on machine. this works fine when i run form on client server environment. but when i run the same form after compiling in 9i and run on 3 tier model and try to run batch file from form it give me error that
    'ftp' is not recognized as an internal or external command,
    operable program or batch file.
    any suggestion?

    It could be because the Host session doesn't have any environment variables set i.e. there is no PATH variable, so it simply doesn't know where to look to find the 'ftp' executable. You could try supplying the explicit path of the ftp executable and see if that works. (This was a problem I had running Host commands on a Unix application server.)
    James

  • Can't run batch file in Windows 2008 R2

    Trying to run batch file (manually first) with powershell commands.
    Powershell commands work fine thru powershell but the batch file will not execute manually.
    I am trying to run as administrator.
    Is there a permission  or policy I may be missing?
    Thanks
    Dave
    Dave Kozlowski

    Hi,
    Some bat type command can't run in the powershell environment, you must confirm you have choiced the correct lunch tools.
    Hope this helps.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Unable to run batch file through BO XI 3.1 server

    IHi,
    I am unable to run batch file (.bat) from BO XI CMC. the batch file is running fine through command prompt but fails at server. Error msg is "Running this type of program is disabled by your administrator".
    Can you help?
    Thanks in advance,
    Avijit

    Have your administrator enabled the running of that type of program in the CMC?
    Sincerely,
    Ted Ueda

  • Can't run Batch files or Devnev (visual studio) - is not recognized .. command

    Getting the famous error :
    ... is not recognized as an internal or external command`*
    When & Where :
    not sure about the total range of the problem,
    Here I can't run batch files and "devneve.exe"
    sample Batch could be :
    @echo off   
    clr
    'clr' is not recognized ...
    **Here are the keynotes:**
     1. I run it as an admin (cmd)
     2. The Path variable seems to have anything needed, Powershell's path is also there sys32..v1
     3. I'm going into the current directory of devnev.exe ...
     4. ran also "devnev.exe"
     5. I don't have 2 cmd s in a known folder
     6. the autorun registries for command prompt were deleted
     7. the cmd extensions were disabled and re-enabled
     8. Avast IS 9 is running,
     9. The system seems to be fine
     10. all .Net frameworks are installed
     11. for a test jetAudio or ILDasm could be executed from the cmd
    Win 8.1 Pro , CPU i7, VS 2013 upd2

    thanks,
    this was one of the silliest problems I've ever encountered, my bad fault,
    the file is DevEnv not DevNev...!
    but about the clr, don't know from when I added them to my batches, but I'm sure the scripts were working correctly a time ago, maybe by a mistake I changed them, I thought it is the most known command, but I was wrong, there is a long time gap between me
    and DOS.

  • Executing batch file as administrator changes working directory

    hey guys,
    I already posted this question on the msdn-forums and they sent me here. I hope, you can help me.
    My situation: I have a java program which I compile with exe4j. exe4j adds some nice features so I can install the program as a service with the command "myexe.exe /install"
    I put that command in a batch file (more user friendly).
    The problem: Only administrators can install services (in Win 7). But if I run the batch-file as administrator, the working directory changes to the system32-directory and I get an "command not found"-error.
    The question: How can I solve this? The only solution I know at the moment is setting a environment variable at installation time that points to the install-location. Is there another way?
    Thx for your help in advance

    With runas you in fact logon to another seesion. So cmd is started with his own starting directory (being where it is located, system32).
    I would recommend never to rely on the working dir for a batch file or script, but to always include the full path to the needed command/executables. If needed you can use environment variables to get the pathes of user-customised folders (for example the %usersprofile% variable).
    Using .lnk files (normal shortcuts) you can specify the working dir to start in if you would really need that functionality.
    MCSA/MCTS/MCP

  • PDQ - run batch file on user current folder...

    Hi,
    I'm running batch file:
    cd %USERPROFILE%\AppData\Local\Microsoft\Windows\Temporary Internet Files\
    but it's not opening the current logged on user
    how to deploy it on current logged on user?
    thanks,,,
    This topic first appeared in the Spiceworks Community

    This is not working for me in Windows 8.  I have a shortcut to an EXE file located in"C:\Users\admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup".  If I set the shortcut to run as administrator (screenshot attached) then it does
    not run at all on startup.  If I uncheckmark "Run as Administrator" then it starts fine (but does not have enough privileges to do what it needs to do).  In Windows 7 this was not an issue since the current user was a local administrator and did
    not need to elevate its privileges further.
    Any ideas how I can work around this problem?  Thanks!
    Ugh... it won't let me attach a screenshot until my "account is verified", whatever that means.

  • Error running batch files from java source file???

    Dear Friends,
    hi,
    this is with response to a doubt i had earlier ,
    i want to run batch files from the java source file ,i tried using this code (here batrun is the batch file name that contains commands to run other java files)
    try
    String [] command = {"c:\\vishal\\finalmain\\batrun"};
    Runtime.getRuntime().exec(command);
    catch(Exception e)
    but i got the following error.
    java.io.IOException: CreateProcess: gnagarrun error= 2
    plz. help me, i tried all combination w/o success,
    in anticipation(if possible give the code after testing)
    Vishal.

    hello there,
    i solved the prob. by using
    cmd /c start filename ,but i need to pass parameters ie
    cmd /c start java "c:/vishal/runfile a b" where a and b are the parameters. but it is not accepting this in Runtime.getRuntime.exec(),
    any solutions ?????????
    regards,
    Vishal

  • Running batch files thraugh java by passing parameters

    Hi
    I want to run a batch file by passing some parameters.
    Eg: copy.bat "D:\live\hoe.txt" "D:\test"
    while doing this from command prompt its working and i have written some java code for running this batch file.
    String live="D:\\live\\how.txt";
    String test="D:\\test";
    String bat="D:\\copy.bat";
    String[] command = new String[3];
    command[0] = bat;
    command[1] = live;
    command[2] = test;
    try {
    Runtime.getRuntime().exec(command);
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    but this time its not copying the file;
    Please help.

    Just another cross poster.
    [http://www.java-forums.org/new-java/15005-running-batch-files-thraugh-java-passing-parameters.html]
    db

  • How to run batch file from oracle forms 9i

    Hi everyone.
    i have a data in csv file. i want to upload it to my database. i am using sql loader for it.
    i have made a batch file which run the sql loader and transfer my data to database.
    How to run batch file from oracle forms 9i.
    when i press the button, nothing uploads in my database. (when i simply run the batch file it works).
    here is my code
    Begin
    HOST('C:\temp\batchfile.bat');
    message('done');
    end;
    Thanks in advance
    regards
    sajid

    this is my log file, when i run manually.
    SQL*Loader: Release 10.2.0.1.0 - Production on Thu Jul 1 23:27:53 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: file_to_upload.ctl
    There are 2 data files:
    Data File: sk.csv
    Bad File: sk.bad
    Discard File: none specified
    (Allow all discards)
    Data File: sk1.csv
    Bad File: sk1.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table KHAN, loaded from every logical record.
    Insert option in effect for this table: APPEND
    Column Name Position Len Term Encl Datatype
    SR FIRST * , O(") CHARACTER
    DATES NEXT * , O(") CHARACTER
    AGENT NEXT * , O(") CHARACTER
    COUNTRY NEXT * , O(") CHARACTER
    TRANSACTIONS NEXT * , O(") CHARACTER
    PKR NEXT * , O(") CHARACTER
    USD NEXT * , O(") CHARACTER
    BANK NEXT * , O(") CHARACTER
    Table KHAN:
    11088 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 132096 bytes(64 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 11088
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Thu Jul 01 23:27:53 2010
    Run ended on Thu Jul 01 23:27:54 2010
    Elapsed time was: 00:00:00.63
    CPU time was: 00:00:00.17

  • Unable to run batch files in my EP server

    Hi,
       I'am unable to run batch files(go.bat and configtool.bat) on my EP server.Anbody please give me a solution.
    With Regards
    Pradeep.B

    If your EP Server is on non-windows based environment then you cannot use go.bat & configtool.bat or else you can. If you are trying to execute these on unix based machines then you have to use go.sh & configtool.sh files.
    Pradeep

  • Task Scheduler won't run batch file automatically

    So, I have a folder filled with the program and the necessary resource files needed in order for it to function. When I start the batch file manually, (double-clicking) it functions as necessary. However, when i schedule it as a task, it either says it "the
    program has stopped working" "a file is missing" (although the file is indeed on the system and in the folder) or it starts the program but it opens it in cmd and opens up a text box with the directory of the folder. Also, I'm running a windows
    8.1 with a x64-bit OS.
    Any help would be greatly appreciated.

    Senor Vega,
    It sounds like it might be a permissions type issue keeping your file from running properly. 
    Check to see what type of user account it is set to run under. 
    It may be that it needs to run under an account with administrative privileges, which you would need to ensure that you have “Run with highest privileges” selected. 
    If you are running the task from a standard user account, make sure you select “Run whether user is logged on or not” and select a user from the administrators group.
    Also check the permissions of the batch file itself to make sure those are set properly.
    Hope this helps!
    Mike
    Windows Outreach Team – IT Pro
    Windows for IT Pros on TechNet

  • Windows task scheduler to run batch file running a java program

    I have created a batch file that runs my SendEmail program. The batch file is in the same directory as the java program. The only line in the batch file is
    java SendEmail
    This works fine from the command prompt but from the windows task scheduler it fails to function. Any help on how I can overcome this problem will be greatly appreciated.
    THanks

    Looks okay. The classpath is set, too, I guess? Btw, try running javaw instead of java. I may err, but I think it can show a console, so you can watch any error messages.

  • Running executable in batch file as administrator when UAC is high

    Hi Team,
    I have a requirement of running executable in batch file by passing the current windows login username as parameters. Below is the content of my batch file:
    cmd /c start setup.exe http://testsite:7001/mobile  %username%  %username%
    But, when the UAC is set high in windows 7 machine, this executable is not running properly, and giving me warnings. And, if I am running the same start command after opening command prompt as administrator, then executable is running smoothly.
    So, is there any way I can run the executable as administrator by giving some options in batch file, when UAC is high?
    I tried runas option, but its prompting for admin password, which we can't provide as users will not know.
    Do we have some option in batch file as 'Run As Administrator' right click option, where it doesn't prompt for password but run the file with admin privilege?
    Thanks,
    Tina Soni

    Hi,
    When using Runas command, you can add a switch option /savecred
    /savecred will make it ask for admin password on the first run only, after that it should be saved
    Yolanda Zhu
    TechNet Community Support

Maybe you are looking for

  • How to open and read many files from a directory and store contents in 2D array?

    I want to make a VI that opens and reads the data from various files contained in a directory (200 files each with 2 columns) and store these in a single 2D array. For file number 1 I want to store the data from both columns in the 2D array, but for

  • How can I back up a Macbook Pro with Bootcamp

    Ok, so I have a 13" Macbook Pro (non-Retina) that's about 5 months old. There's loose wiring in the display, causing strange symptoms with my screen. There also seems to be something stuck in the fan, as it rattles around really loudly from inside th

  • Find files on Time Machine that weren't in the "Latest Backup"?

    I restored my new Mac with the "Latest Backup" of Time Machine. I now understand that I will have to erase the whole backup harddrive in order to continue using Time Machine (I cannot get it to do incremental backups with my new computer from where I

  • Microsoft Exchange - iOS 7.0.3

    I work for the IT department of the city I live in. Back in 2009 I setup my echange email on my iPhone 3G. I used the wembail server name to get the email to work on my phone. It has worked great even when upgrading to the newer iPhones. However, my

  • Getting Error in Data Collection - FDPSTP failed due to ORA-23401

    Hi All, I am really new to ATP Setup and after referring to the Metalink notes, I have compelted the setups required to calculate ATP in Sales Order Window. But when I am submitting the Data Collection which is the last step I guess, the program is e