Search Results

Search found 3987 results on 160 pages for 'batch rename'.

Page 7/160 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • How to concatenate multiple lines of log file into single variable in batch file?

    - by psych
    I have a log file containing a stack trace split over a number of lines. I need to read this file into a batch file and remove all of the lines breaks. As a first step, I tried this: if exist "%log_dir%\Log.log" ( for /F "tokens=*" %%a in ("%log_dir%\Log.log") do @echo %%a ) My expectation was that this would echo out each line of the log file. I was then planning to concatenate these lines together and set that value in a variable. However, this code doesn't do what I would expect. I have tried changing the value of the options for delims and tokens, but the only output I can get is the absolute path to the log file and nothing from the contents of this file. How can I set a variable to be equal to the lines of text in a file with the line breaks removed?

    Read the article

  • Administrator's shortcut to batch file with double quoted parameters

    - by XXB
    Take an excruciatingly simple batch file: echo hi pause Save that as test.bat. Now, make a shortcut to test.bat. The shortcut runs the batch file, which prints "hi" and then waits for a keypress as expected. Now, add some argument to the target of the shortcut. Now you have a shortcut to: %path%\test.bat some args The shortcut runs the batch file as before. Now, run the shortcut as administrator. (This is on Windows 7 by the way.) You can use either right-click - Run as Administrator, or go to the shortcut's properties and check the box in the advanced section. Tell UAC that it's okay and once again the shortcut runs the batch file as expected. Now, change the arguments in the target of the shortcut to add double quotes: %path%\test.bat "some args" Now try the shortcut as administrator. It doesn't work this time! A command window pops up and and disappears too fast to see any error. I tried adding test.log 2&1 to the shortcut, but no log is created in this case. Try running the same shortcut (with the double quotes) but not as Administrator. It runs the batch file fine. So, it seems the behavior is not because of the double quoted parameters, and it's not because it's run as Administrator. It's some weird combination of the two. I also tried running the same command from an administrator's command window. This ran the batch file as expected without error. Running the shortcut from the command window spawned a new command window which flashed and went away. So apparently the issue is caused by a combination of administrator, the shortcut, and the double quotes. I'm totally stumped, does anyone have any idea what's going on?

    Read the article

  • rename folder into sub-folder with PHP

    - by Workoholic
    Hi. I'm trying to move a folder by renaming it. Both the test1 and test2 folders already exist. rename( "test1", "test2/xxx1/xxx2" ); The error I get is: rename(...): No such file or directory I assume this is because the directory "xxx1" does not exist. How can I move the test1 directory anyway?

    Read the article

  • Rename/Move file only if destination does not exist

    - by mikeY
    I would like to know if there is any way a file can be moved only if the destination does not exist - in other words, move only if it does not lead to overwriting. mv --update seemed first to be the solution, however, if the timestamp of the source path is newer than the destination, move will overwrite it and all attempts to circumvent this by modifying the timestamp before the move will fail. I need this behaviour to implement a simple file based lock where existence of a 'lock' file indicates that the lock is acquired.

    Read the article

  • Running batch file through a service.

    - by wallz
    I'm trying to schedule a batch file to run through a third party application, however the output file doesn't get created in the directory. If I run the .BAT file from the command line, it works and the file gets created. Also using the Windows Schedule will also succeed. Basically, the 3rd party software will schedule the .BAT file and it shows success within the 3rd party user interface. The difference between running from the command prompt and the software, is that the software will use its Windows service to launch the batch. The 3rd party software will show success since it was able to successfully call the .BAT file to run, however it has no control of the other EXE's that's being called within the script. I'm able to run a simple .BAT file in the 3rd party software, for example a copy command. The .BAT I'm having problems with calls a compiled EXE which launches Excel to create a file to a location. The .bat file calls something.exe, which then calls Excel.exe: C:\something.exe -o D:\filename.xlsm C:\filename.xlsm refresh_pivot Do you think it's a permissions issue? I used Process Monitor to verify any Access Denied errors but everything seems to be working according to the trace. It worked on a non-64-bit OS, I'm currently using Win2008 64-bit.

    Read the article

  • Moving hidden files/folders with the command-line or batch-file

    - by Synetech
    Question Does anyone know of a way to move files and folders that have the hidden, system, or read-only attribute set from the command-line or a batch file? (No, stripping the attributes first is not an option since there is no practical way to know which attributes were set in order to re-set them after the move.) (Failed) Attempts Using the basic move command does not work with items with the hidden or system attribute set and for some reason, it does not have switches to specify attributes like the dir and del commands do. I tried using a utility I wrote that uses the shell’s file operation function, but that requires using start /w to prevent the batch file from running on ahead, and it complains about long-filename support for some reason. I tried using robocopy, but it first copies the files and then deletes the originals instead of simply moving the source (which results in a frustrating delay, even with the excessive output redirected to nul). (Surprisingly it seems that few people have ever needed to move hidden files from the command-line. All I could find was this one person who abandoned the attempt.)

    Read the article

  • Migrating ODBC information through a batch file

    - by DeskSide
    I am a desktop support technician currently working on a large scale migration project across multiple sites. I am looking at a way to transfer ODBC entries from Windows XP to Windows 7. If anyone knows of a program or anything prebuilt that already does this, please redirect me. I've already looked but haven't found anything, so I'm trying to build my own. I know enough basic programming to read the work of others and monkey around with something that already exists, but not much else. I have come across a custom batch file written at one site that (among other things) exports ODBC information from the old computer and stores it on a server (labelled as y: through net use at the beginning of the file), then later transfers it from the server to a new computer. The pre-existing code is for Windows XP to XP migrations. Here are the pertinate bits of code: echo Exporting ODBC Information start /wait regedit.exe /e "y:\%username%\odbc.reg" HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI (and later on) echo Importing ODBC start /wait regedit /s "y:\%username%\odbc.reg" We are now migrating from Windows XP to 7, and this part of the batch file still seems to work for this particular site, where Oracle 8i and 10g are used. I'm looking to use my cut down version of this code at multiple sites, and I'm wondering if the same lines of code will still work for anything other than Oracle. Also, my research on this issue has shown that there are different locations in 64 bit operating systems for 32/64 bit entries, and I'm wondering what effect that would have on the code. Could I copy the same data to both parts of the registry, in hopes of catching everything? Any assistance would be appreciated. Thank you for your time.

    Read the article

  • Old School Wizardry Tip: Batch File Comments

    - by jkauffman
    Johnny, the Endangered Keyboard-Driven Windows User Some of my proudest, obscure Windows tricks are losing their relevance. I know I’m not alone. Keyboard shortcuts are going the way of the dodo. I used to induce fearful awe by slapping Ctrl+Shift+Esc in front of the lowly, pedestrian Windows users. No windows key on the keyboard? No problem: Ctrl+Esc. No menu key on the keyboard: Shift+F10. I am also firmly planted in the habit of closing windows with the Alt+Space menu (Alt+Space, C); and I harbor a brooding, slow=growing list of programs that fail to support this correctly (that means you, Paint.NET). Every time a new version of windows comes out, the support for some of these minor time-saving habits get pared out. Will I complain publicly? Nope, I know my old ways should be axed to conserve precious design energy. In fact, I disapprove of fierce un-intuitiveness for the sake of alleged productivity. Like vim, for example. If you approach a program after being away for 5 years, having to recall encyclopedic knowledge is a flaw. The RTFM disciples have lost. Anyway, some of the items in my arsenal of goofy time-saving tricks are still relevant today. I wanted to draw attention to one that’s stood the test of time. Remember Batch Files? Yes, it’s true, batch files are fading faster than the world of print. But they're not dead yet. I still run into some situations where I opt to use batch files. They are still relevant for build processes, or just various development workflow tools. Sure, there’s powershell, but there’s that stupid Set-ExecutionPolicy speed bump standing in your way; can you really spare the time to A) hunt down that setting on all machines affected and/or B) make futile efforts to convince your coworkers/boss that the hassle was worth it? When possible, I prefer the batch file wild card. And whenever I return to batch files, I end up researching some of the unintuitive aspects such as parameters, quote handling, and ERRORLEVEL. But I never have to remember to use “REM” for comment lines, because there’s a cleaner way to do them! Double Colon For Eye-Friendly Comments Here is a very simple batch file, with pretty much minimal content: @ECHO OFF SETLOCAL REM This is a comment ECHO This batch file doesn’t do much If you code on a daily basis, this may be more suitable to your eyes: @ECHO OFF SETLOCAL :: This is a comment ECHO This batch file doesn’t do much Works great! I imagine I find it preferable due to the similarity to comments in other situations: // or ;  or # I’ve often make visual pseudo-line breaks in my code, and this colon-based syntax works wonders: @ECHO OFF SETLOCAL :: Do stuff ECHO Doing Stuff :::::::::::::::::::::::::::: :: Do more stuff ECHO This batch file doesn’t do much Not only is it more readable, but there’s a slight performance benefit. The batch file engine sees this as an invalid line label and immediately reads the following line. Use that fact to your advantage if this trick leads you into heated nerd debate. Two Pitfalls to Avoid Be aware of that there are a couple situations where this hack will fail you. It most likely won’t be a problem unless you’re getting really sophisticated with your batch files. Pitfall #1: Inline comments @ECHO OFF SETLOCAL IF EXIST C:\SomeFile.txt GOTO END ::This will fail :END Unfortunately, this fails. You can only have whitespace to the left of your comments. Pitfall #2: Code Blocks @ECHO OFF SETLOCAL IF EXIST C:\SomeFile.txt (         :: This will fail         ECHO HELLO ) Code blocks, such as if statements and for loops, cannot contain these comments. This is ultimately due to the fact that entire code blocks are processed as a single line. I originally learned this from Rob van der Woude’s site. He goes into more depth about the behavior of the pitfalls as well, if you are interested in further details. I hope this trick earns you serious geek rep!

    Read the article

  • Download a File in a Batch File

    - by Cristian
    I've never done any scripting on Windows but now I need to write a batch file that downloads a file off the internet (amongst other things). If it was linux I would use wget. Is there a builtin executable that will download a file to a given directory? This needs to run on XP.

    Read the article

  • Batch Conversion of PaperPort MAX Files

    - by Matthew
    I've got a library of MAX files from an old Visioneer Scanner that used ScanSoft PaperPort. I don't have the PC that I used to scan them anymore, and I don't have the CD for PaperPort. Does anyone know of a utility I can use to open and convert .MAX files to something more useful like a JPEG? (I'd prefer something that batch converts -- but if I can get a utility that will even allow one conversion, I could probably figure out how to use AutoHotkey or something like that to automate.) Thanks for your help

    Read the article

  • Batch convert *.avi files using ffmpeg

    - by Darius
    I am trying to convert 20+ .avi files in a batch using ffmpeg. I've got the following @echo off. for file in *.avi do ffmpeg -i "$file" -s 640x480 -vcodec msmpeg4v2 "'basename "$file" .avi'.mpg'; done in my .bat file but it does not work. How can I make it work under Windows OS. Oh, and yes all the files are in the same folder. The error message I get: File was unexpected at this time

    Read the article

  • Run a completly hidden batch file

    - by Moayad Mardini
    I'm looking for some way to run a batch file (.bat) without anything visible to the user (no window, no taskbar name, .etc..). I don't want to use some program to do that, I'm looking for something cleaner. I've found a solution that uses VBScript, but I don't really like using VBS, either.

    Read the article

  • Print the file name with another extension (Batch-program)

    - by Semyon Perepelitsa
    Batch-program launchs with 1 parameter (full path to file) program.cmd "C:\Path\To\File\Filename.txt" Now, this program consists of 1 command: echo %1 And it just prints an argument: C:\Path\To\File\Filename.txt for the upper example. But I want it to print an argument (full path) with another extension, e.g. .exe. For the upper example, I want it to print C:\Path\To\File\Filename.exe. How to make it do that?

    Read the article

  • Batch script for unattended install of a software

    - by Spidfire
    Ive got a few programms i need to install every time i reinstall a computer office 2003 Pro office 2007 compatibility pack Adobe acrobat Adobe flash but i hate to do this every time on every computer ive already made a batch script when i boot xp the first time after reinstall like @echo off "I:\installs\adobe reader\setup.exe" pause "I:\installs\office 2003\setup.exe" pause "I:\installs\office compatibilitiy\setup.exe" but it doesnt install automatic, is that possible?

    Read the article

  • remove registry keys using reg.exe in a batch script

    - by Lex
    I've written this little batch script to help me auto-clean the registries of 300+ identical PC's of some very specific registry keys. It works right up to the point of passing the key variable to the "reg delete %1" command. @echo off C: cd C:\Program Files\McAfee\Common Framework\ framepkg.exe remove=agent /silent setlocal for /F %%c in ('REG QUERY HKLM\SOFTWARE /s^|FIND "HKEY_"^|findstr /L /I /C:"mcafee"') do call :delete %%c endlocal goto :EOF :delete reg delete /f %1 pause Any and all debugging help would be extremely appreciated!

    Read the article

  • delete duplicate files with windows batch file?

    - by Chris Sobolewski
    I have a program that automatically copies files to a directory, and if it creates a duplicate it will name it like so: file with duplicate.xxx file with duplicate - 1.xxx file with duplicate - 2.xxx I need a way to delete all the duplicates with a windows batch file. Something along the lines of: FOR %f IN (C:\files\*.*) DO del "%f - 1" However, that will not work because that would resolve to file with duplicate - 1.xxx - 1

    Read the article

  • Run batch file with custom drive mappings

    - by mwolfe02
    I want to create a "mini virtual environment" to run a program. The only difference between my normal environment and the virtual one would be the drive mappings. I have an X: drive mapped to \\some\network\location I have a program myapp.exe that expects the X: drive to be mapped to C:\local\path I need to keep my X: drive mapped to \\some\network\location throughout the process I would like to be able to run the following batch file and not have it affect the current environment: subst X: C:\local\path myapp.exe

    Read the article

  • FTP from batch file

    - by Buzkie
    I'm trying to use a batch file to download a package off my FTP server. echo username >ftp.txt echo >>ftp.txt echo cd directory >>ftp.txt echo get filename >>ftp.txt ftp -s:ftp.txt server.com The server is set to allow anonymous logins on username but when I run the script I get an error: 331 Password required for username If there is any other useful information let me know. -Alex

    Read the article

  • Automatically restore windows network drive (red "X") via batch file

    - by user33958
    i need check if a network drive is mapped and accessible. From time to time windows displays a red X on the drive, and i would need to manually click the drive in explorer to reconnect. I already found solutions which involve editing the registry which unfortunately isn´t possible. So i would need a batch file checking for connection, and (re-)mounting the drive. What i´m using at the moment: IF NOT EXIST z: net use z: \\10.211.55.5\test

    Read the article

  • Batch file to check the size and print the outout

    - by OraR
    I am trying to make a batch file and that would check the size of f1.txt file and if the size is 1118 then no changes will be displayed if not the file has been changed. @ECHO OFF set maxbytesize=1118 set "filename=f1.txt" for %%A in (%filename%) do echo.Size of "%%A" is %%~zA bytes if %%~zA==%maxbytesize% ( echo "No Changes" pause >nul exit ) echo "Changes" pause >nul exit Please can someone let me know any possible guidelines for the above. Thanks.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >