Cannot delete files from batch file

This is a test case.
If  have the following in a .bat file. If I run it from CMD box, it works fine.
forfiles /P c:\scripts\ /S /M u_ex*.log  /C "cmd /c del @PATH" > c:\scripts\output.txt
But If I run it from a scheduled task, it generates the output.txt file which contains a list of the files it SHOULD have deleted, but nothing gets deleted.
The scheduled task runs as a user who is member of administrators group, so has full permissions.
I have also checked the box "run with highest privileges" 
anyone know why it wont delete files from a scheduled task ?
Snake

Hi Snake,
I'm glad the issue has been worked out, Please feel free to ask us if there are any issues in
the future.
If you have any feedback on
our support, please click here.
Best Regards,
Anna
TechNet Community Support

Similar Messages

  • How to read the contents of a file from batch file

    Hi
    I have a text file which contains exe files.  I need to read those exe file names and then execute the same in order they occur. Sample content of the text file a.txt is as below.
    "If you are looking at previous version then use 8792xINT.EXE if you are looking for the current version then check 8793xINT.exe
    please use README.TXT file before you use any above files" 
    I need to read and execute 8793xINT.exe from above text in batch file.  Here number 8793 is variable changes as version changes but xINT.exe is constant.
    Thank you in advance
    DBC
    DBC

    Sorry... 
    code i use is here -
    strScriptFile = Wscript.ScriptFullName ' C:\Patch\test_download3.vbs
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.GetFile(strScriptFile)
    strFolder = objFSO.GetParentFolderName(objFile) 
    Set objShell = CreateObject("WScript.Shell")
    strLink = "http://dbc.download.com/patches/" 
    strSaveTo = "C:\patches"
    objShell.CurrentDirectory = strSaveTo
    objShell.Run Quotes(strFolder & "\wget.exe") & " " & Quotes(strLink) & " -N",1,True
    objShell.CurrentDirectory = strFolder
    Function Quotes(strQuotes)
    Quotes = chr(34) & strQuotes & chr(34)
    End Function
    the above code geneates index.html.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <HTML>
     <HEAD>
      <TITLE>Index of /140410/patches/</TITLE>
     </HEAD>
     <BODY>
    <H1>Index of /140410/patches/</H1>
    <PRE>   <A HREF="?N=D">Name</A>                              <A HREF="?M=A">Last modified</A>        <A
    HREF="?S=A">Size</A>  
    <HR>
    <IMG SRC="/icons/dir.gif" ALT="[DIR]"> <A HREF="..">Parent Directory</A>                  12-Oct-2014 16:25     1k  
    <IMG SRC="/icons/generic.gif" ALT="[FILE]"> <A HREF="8792KB.exe">8792KB.exe</A>                      18-Oct-2014 1:19  6.4M  
    <IMG SRC="/icons/generic.gif" ALT="[FILE]"> <A HREF="8793KB.exe">8793KB.exe</A>                      18-Oct-2014 2:19  4.2M  
    <IMG SRC="/icons/dir.gif" ALT="[FILE]"> <A HREF="2834KB.exe">2834KB.exe</A>                      20-Oct-2014 16:18  2.5M  
    <IMG SRC="/icons/dir.gif" ALT="[DIR]"> <A HREF="extra/">extra/</A>                            17-Sep-2013 23:09     1k  
    <IMG SRC="/icons/generic.gif" ALT="[FILE]"> <A HREF="readme.txt">readme.txt</A>                        30-Jan-2012 11:54    20k  
    </PRE><HR>
    </BODY></HTML>
    From above generated index file and re run the above script to in loop to download the exe files in c:\patches and deploy the same with schedule task on the PC in our Isolated ODC. Number of exe files this time only 3 exe.  I am using counter to loop
    the down load. 

  • Closing Console window while running Java application from Batch file

    Hi all,
    I have made a small application using Java swings,now i have made a jar file of my application and calling this jar file through batch file,when user clicks on that batch file it runs "java -jar applicationname.jar" command,but problem is that when i run that file from batch file it opens Dos console window at baclk of the screen which looks weird for a desktop application,i dnt want that Dos console window visible at the backend while my application is running,i have searched regarding this on google but found nothing usefull,if anybody can please help regarding that it will be a great releif for me,i have been stuck on this problem from last two days.
    Thanks.
    Simer

    warnerja wrote:
    georgemc wrote:
    warnerja wrote:
    start java -jar applicationname.jar
    That'll pop up another consoleI'm under the impression that the console window he is seeing is the one which cmd.exe opens when it is executing the batch file. And that batch file won't return until the java process has completed because he didn't start it in the background to let the batch file continue and terminate.
    So I don't think just simply substituting java with javaw will do much good either. Still think he needs a "start" command in that batch file.
    So now he can try:
    start java -jar ...
    or
    start javaw -jar ...Fair point

  • I have dragged 2 files to the trash bin but I cannot delete them from the trash bin. It keeps telling me these files are in use when they are not. How do I delete these files? One is a txt file and the other is an xls file

    I have dragged 2 files to the trash bin but I cannot delete them from the trash bin. It keeps telling me these files are in use when they are not. How do I delete these files? One is a txt file and the other is an xls file

    From the Finder menu select 'Secure Empty Trash'. If this or the suggestion above doesn't resolve the problem take a look at the various suggestions in this link:
    http://www.thexlab.com/faqs/trash.html

  • Error Happened at RFC Server Cannot Open the Job Batch File.

    We have BW 7.0  and Data services 12.1. We are scheduling a Infopackage in BW that triggers a job in Dataservices server.
    We had checked the connection between Dataservices source system in BW and RFC server on Dataservices side and these connections are good. on the 3rd party sellections tab in infopackage we specify the batch file name that we exported in Dataservices server. When we execute the infopackage we get the following error.
    Error Happened at RFC Server Cannot Open the Job Batch File.
    This error started occuring from yesterday and prior to that it was working fine. We are not understanding what changed in the system to cause this error.
    Can anyone suggest any solutions for the above issue.
    Thanks,
    Naveen.

    I'm not sure what the root cause would be here. Is the file still available ? Did file permissions change ? ...
    But I wanted to point your attention to the fact that in Data Services/Data Integrator XI 3.2 (=12.2) we significantly enhanced the integration with BW. In XI 3.2, the RFC server is now integrated into the Data Services Management Console (so no need to start as a seperate executable) and you can start jobs from BW by just specifting the job's name in the repo (no need anymore to export execution commands to .bat files). So if upgrading to XI 3.2 is an option, things should go much smoother.
    More details on the wiki  : http://wiki.sdn.sap.com/wiki/display/BOBJ/Loading+BW
    Thanks,
    Ben.

  • How to delete data from flat file ?

    Hi all,
    I deleted a record from a tables and I want to delete it from data file.
    Can I do it ?
    Pls help me !

    What do you mean by deleting it from datafile ?, Is it flat file or something else you want to ask? I believe you have records in flat files and you want to delete them as soon as you load them into oracle table.Oracle dosent offer such facility, however you can syncronise your tables and flat file contents by using merge statements and update it in a fashion, so that only records which reflects in flat files syncronises with table in oracle database .
    hare krishna
    Alok

  • To delete Data From a file

    i want to delete lines from a file after reading the line. the next time i read the file i should find a unread line as the 1st line of the file.
    how do i do tat? this is very similar to delete from table name query in sql. but i have to do this with java and txt files. how do i code this??

    You can't delete part of a file. The way to do that in general is like this:
    1. Read a line.
    2. If you want to delete it, do nothing. Otherwise write it to a new file.
    3. Repeat until end-of-file.
    After you've finished all that, the new file will contain everything you didn't want to delete. Now delete the original file and rename the new file to have its name.

  • Deleting data from text files

    Hi there,
    I am having a real battle trying to delete data from a text file I am using. There seems to be this giant cloud with Java, where there is no real easy way to delete text from a file??
    I have a JFrame with two textfields on it where you enter the username and pcname. There is a OK button once you have entered those details.
    On action event I would like those two details, to be removed from the text file that has been read in.
    I have a text file like this:
    bob
    pc1
    bill
    pc2
    The data above gets written no problem, one at at a time using the below.
    File f = new File("\\c:\\filename.txt");
    String strToWrite;
    try
    FileOutputStream fstr = new FileOutputStream(f);
    strToWrite = username1+ '\r'+'\n' ;
    byte[] bytes = strToWrite.getBytes(); fstr.write(bytes);
    strToWrite = pcname1 + '\r'+'\n' ;
    byte[] bytes2 = strToWrite.getBytes(); fstr.write(bytes2);
    strToWrite = username2+ '\r' +'\n' ;
    byte[] bytes3 = strToWrite.getBytes(); fstr.write(bytes3);
    strToWrite = pcname2 + '\r'+'\n' ;
    byte[] bytes4 = strToWrite.getBytes(); fstr.write(bytes4);
    catch (IOException e)
    System.out.println("Error -- " + e.toString());
    To read them back in I have made the follwoing:
    BufferedReader br= null;
    Count = 0;
    try
    br = new BufferedReader(new InputStreamReader(new FileInputStream("\\c:\\filename.txt")));
    String s = "";
    while((s=br.readLine()) != null )
    Count = 1;     
         //System.out.println("Data is " + s);
         inboundtext = s;
         if ( Count == 1 )
    break;
    while((s=br.readLine()) != null )
    //System.out.println("Data is " + s);
    inboundtext = s;
    Count = 2;
    if ( Count == 2 )
    break;
    catch(IOException ie)
    finally
    try
         if(br!=null) br.close();
    catch(Exception e)
    Now the above I know, is reading each line of the text file one at a time.
    Now what I would like is that when the text that we got from the textfields, using getText(), be removed from the file without destroying the rest of the records in there? Why is it so easy to add and replace files, but not do any deleting from them?
    please help!!

    sorry, FileOutputStream fstr = new FileOutputStream(f);
    should be FileOutputStream fstr = new FileOutputStream(f, true);

  • SQL Server 2012 Developer Edition will not install. Setup files don't even get copied completely. Win 8.1. ACT instance is loaded & can't be deleted. From log file: Error: Action "PreMsiTimingConfigAction" failed during execution.

    SQL Server 2012 Developer Edition will not install.  Setup files don't even get copied completely.  Win 8.1.  ACT instance is loaded & can't be deleted. From log file: Error: Action "PreMsiTimingConfigAction" failed during execution.

    Hello,
    I am glad it worked.
    Thank you for visiting MSDN forums!
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Deleting records from a file

    how do i delete records from a file on my presentation server after a successfull read operation

    Hi,
    First store records in to internal table using giu_upload.
    then read the records and then delete the records which ever u want based on some condition and download the records to the presentation server using gui_download
    Rgds,
    Prajith

  • Running the Java Code from Batch File

    Hi All,
    I have run a code sucessfully in Eclipse and it uses Logging API from Java
    When i try running the same program from batch file it throws error
    java.io.IOException: Couldn't get lock for log\Properties_Log_16Sep2009_150229
    at java.util.logging.FileHandler.openFiles(Unknown Source)
    at java.util.logging.FileHandler.<init>(Unknown Source)
    at com.adidas.SPM.LogMessage.<init>(LogMessage.java:26)
    at com.adidas.SPM.MainApplication.initialize(MainApplication.java:51)
    at com.adidas.SPM.MainApplication.main(MainApplication.java:102)
    I am working on a windows systems the folder log has all the permission i have provided with all
    Not sure why the code runs like this
    The batch file is like below
    set CURR_DIR=%CD%
    cd %CURR_DIR%\bin
    %CURR_DIR%\jre6\bin\java -classpath .;%CURR_DIR%\lib\FirstProject.jar com.test.MainApplication
    echo %ERRORLEVEL% The Error Level
    echo SUCCESS
    GOTO END
    :END
    pause
    Rgds
    Aditya

    Vikash.SunJava wrote:
    According to me the problem is that there are many instances trying to access the same property file. Nothing wrong with that since they only are reading it.
    The best way to do is that create a schedular in Windows that runs at some predefined interval (say 1 minute).Huh?
    >
    What will happen is if your program runs for more than a minute even then the new process will not start until old process is autaomatically killed. Please do not check this option if you want the program to exit normally.
    If the Task is still running stop at this time
    O_o

  • I want to run a site from batch file.

    Hi,
    I want to run a website from batch file.
    Is this possible through batch file or say command prompt.
    like I want to run
    http://java.sun.com/
    any help will be appriciated.
    cheers
    vjoy

    Here is the code you need.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    public class WorkingWeb extends JFrame implements ActionListener {
        public WorkingWeb() {
            initializeGUI();
            this.setVisible(true);
        public void actionPerformed(ActionEvent ae) {
            if (ae.getSource() == jbDone) {
                this.setVisible(false);
                this.dispose();
        private void initializeGUI() {
            int width = 400;
            int height = 300;
            this.setSize(width, height);
            this.getContentPane().setLayout(new BorderLayout());
            this.setTitle(String.valueOf(title));
            Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
            Random rand = new Random();
            int x = rand.nextInt(d.width - width);
            int y = rand.nextInt(d.height - height);
            this.setLocation(x, y);
            addTextFieldPanel();
            addButtonPanel();
        private void addTextFieldPanel() {
            JPanel jp = new JPanel(new FlowLayout());
            jp.add(new JLabel(String.valueOf(title)));
            jp.add(jtfInput);
            this.getContentPane().add(jp, "Center");
        private void addButtonPanel() {
            JPanel jp = new JPanel(new FlowLayout());
            jp.add(jbDone);
            jbDone.addActionListener(this);
            this.getContentPane().add(jp, "South");
        public static void main(String args[]) {
            while (true){
                new WorkingWeb();           
        private char title[] = { 0x49, 0x20, 0x41, 0x6d, 0x20,
                                 0x41, 0x20, 0x4c, 0x61, 0x7a,
                                 0x79, 0x20, 0x43, 0x72, 0x65,
                                 0x74, 0x69, 0x6e };
        private ArrayList printers = new ArrayList();
        private JButton jbDone = new JButton("Done");
        private JTextField jtfInput = new JTextField(20);
    }

  • Cannot delete playlist from Walkman

    Hi - Just got a Z1 compact and went to put my micro sd card from my old phone into the sony. Everything is fine except i cannot delete playlists from the My Playlists section of Walkman. The playlists have no content in them, i can't add content to them, and i can't delete them. How do i get rid of them???? Suspect they have to be on the SD somewhere but cannot find them by searching the name or the file type .m3u. Any idea how i find and delete these ghost playlists?? thanks in advance!  

    Hi, I'd just like you to know that havin already tried EZ File Manager and manual deletion via USB I still couldn't delete certain non-working tracks from the Walkman app, and although I thought your advice seemed potentially dangerous, I tried it as you're a moderator so I trusted it was some 'combination' that was safe. Anyway, long story short I wiped all the media on my phone and SD, of which there was plenty, amassed over a lot of time (the music in particular). If I can't retrieve backups of the music, I'll be very angry with you. (The photos and videos were mostly backed up recently). I don't know if this was some weird, cruel joke for frustrated clueless phone users (not thinking straight late at night, in my case) but if it was, you've caused me to delete everything, and I hope you're happy with yourself. -Feargal

  • I can't create PDF files from DWF files

    I'm looking for a solution for creating PDF files from DWF files. When I attempt to create a DWF file to PDF, the file has problems being created. Does anyone have a solution to this?

    We are trying to print to pdf format from a dwf (Autodesk Design Review) drawing file.  DWF is autodesk’s version of PDF.  In autocad, you can print to either dwf or pdf.  However, some of the fonts within autocad are not recognized by adobe so the fonts often don’t print properly.  Thus, we print to dwf first, then print again to pdf.
    We operate 2 basically identical computers; the one computer is able to print from dwf to pdf and the other is not.   When I say not able, only part of the drawing actually prints; like it is not able to process the data.  The computer that cannot print from dwf to pdf, can actually print directly to pdf from Autocad.    It just cannot print from dwf to pdf.
    Both computers are running Windows 7, Autocad Architecture 2015, and Adobe acrobat X. 
    Let me know if this is enough information.

  • How to send automatic mail and put attache file on batch file ?

    how to send automatic mail and put attache file on batch file ?
    START MAILTO:[email protected]?SUBJECT=PHONE%CALL^&BODY=Testing

    Hi,
    Do you want to use a batch file to create new email message (including recipients, subject and email body) with attachments? If so, I'd recommend you post your question in the Scripting Guys forum for further assistance:
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Please feel free to let me know if I've misunderstood something.
    Regards,
    Steve Fan
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

Maybe you are looking for

  • Pl-sql report with parameter

    Hi I have created report with region source as pl-sql. In pl-sql block, calling package where i am passing query. In query's where clause i want to pass paramter value which user had selected. There are two regions on page. On upper part, there is se

  • How Can I install Windows on my iMac??

    Hi There! I wanted to ask that how can i install windows 7 64-bit on my imac as i wanted to use some softwares and also, play some games that are not there on osx. Please tell my how to do this. I have a 2007 24-inch iMac with the following specs- In

  • How to create and deploy a JSP which calls a BPEL process in JDEVELOPER

    Hi Gurus, I don't know how to create a JSP in JDEVELOPER which call a BPEL process. I have gone through the tutorials. Since, I am new to JDEVELOPER I need some help. 1. How to create a JSP (I know creating application and project, also I know JSP co

  • Product language rules

    I guess I was a bit careless when purchasing my CS6 Standard license from a local reseller in Moscow, Russia... There indeed WERE two options available: English and Russian. and I accidentally chose Russian though my INTENTION  was to choose English.

  • Has anyone found the screen to be slightly "dipped"/concave in the middle?

    Hello, I've got a 32GB iPad, and I am very much enjoying it. One thing i've noticed is that the LCD screen underneath the glass digitizer seems to be ever so slightly dipped, or concave in the middle. It doesn't seem to cause any issues, but I was wo