Windows 10: Simple batch file driving me nuts

Discus and support Simple batch file driving me nuts in Windows 10 Software and Apps to solve the problem; All I want to do is check if a folder exists on a network share and if it does, copy a file to it. Should be a piece of cake. Here is my code: Code:... Discussion in 'Windows 10 Software and Apps' started by Ztruker, Aug 18, 2019.

  1. Ztruker Win User

    Simple batch file driving me nuts


    All I want to do is check if a folder exists on a network share and if it does, copy a file to it. Should be a piece of cake. Here is my code:

    Code: @echo on set "newFile=Just a test file.txt" set "hostTarget=\\Kfwserver\HP_D\ShowkeyPlus Data\" if exists "%hostTarget%" copy "%userprofile%\Documents\%newfile%" "%hostTarget%" else echo "%hostTarget%" not found.[/quote] When I run it I get this:

    Code: >test C:\Users\ztruk>set "newFile=Just a test file.txt" C:\Users\ztruk>set "hostTarget=\\Kfwserver\HP_D\ShowkeyPlus Data\" "\\Kfwserver\HP_D\ShowkeyPlus Data\" was unexpected at this time. C:\Users\ztruk>if exists "\\Kfwserver\HP_D\ShowkeyPlus Data\" copy "C:\Users\ztruk\Documents\Just a test file.txt" "\\Kfwserver\HP_D\ShowkeyPlus Data\"[/quote] If I have just the first two lines all is well, so it's the third line that is causing the problems but I cana't figure out what is wrong.

    :)
     
    Ztruker, Aug 18, 2019
    #1
  2. djmonson Win User

    help with simple batch file

    sorry if i wasn't specific enough. and i don't need it to be a batch file necessarily.

    i want an automated way to move files from one folder to another (both on the C drive)
    but i want it to move all mp3 files EXCEPT for the ones that begin with an underscore
     
    djmonson, Aug 18, 2019
    #2
  3. Try3 Win User
    Need solution for automating transferring of files to flash drives


    I am wary of jumping straight in at the deep end so I have a couple of questions.

    1 How do you know which files to copy to which memory stick? Can you put a list for each one in a text file?
    2 Are you free to give each memory stick a specific label so that it can be detected in order to trigger the specific list that you have written for that memory stick?

    I do have a batch file procedure for identifying the drive letter currently being used for a given external drive label. So perhaps you could trigger a common batch file that
    Step 1 - checks each drive in turn to read its label and then find its current drive letter
    Step 2 - for each detected drive, look up the list given in the batch file to identify which [if any] text file to look in to find the files to copy to that memory stick.
    Step 3 - copies the files listed in the relevant text file

    Denis
     
  4. djmonson Win User

    Simple batch file driving me nuts

    help with simple batch file

    i want to create a batch file that will:
    move files from 'directory1' to 'directory2'
    if (and only if) the file DOES NOT begin with an underscore

    anyone know how to do this??

    David
     
    djmonson, Aug 18, 2019
    #4
Thema:

Simple batch file driving me nuts

Loading...
  1. Simple batch file driving me nuts - Similar Threads - Simple batch file

  2. KB5031354 Problem Driving me nuts

    in Windows 10 Gaming
    KB5031354 Problem Driving me nuts: I installed KB5031354 through this linkhttps://catalog.update.microsoft.com/Search.aspx?q=KB5031354The installation completed OKThe Windows version is OKBUT...In Windows update the update appears as pending, and it tries to install it again and again.It is annoying.Can...
  3. windows installer driving me nuts

    in Windows 10 Gaming
    windows installer driving me nuts: Hellow I upgraded from win 7 to win 10 a couple months ago, and every since windows installer keeps trying to install office 03 that I upgraded to office 10 years ago, every time I open any program I have keep clicking cancel until it quits and lets my program open. Please...
  4. Folder/file sort is driving me nuts

    in Windows 10 Customization
    Folder/file sort is driving me nuts: Now, I know my little issue is not too big of a deal but it's driving me batty because I'm a stickler for file and folder maintenance. Here's what I want but cannot accomplish. I want file explorer systemwide to sort with FOLDERS FIRST followed by files, all alphabetically. I...
  5. Driving me Nuts

    in Windows 10 Ask Insider
    Driving me Nuts: [ATTACH] Every time I restart my pc or rarely where my pc crashes my lock screen is switched to this photo. I've done a system image search but failed to find it. Right clicking on the off screen prompt takes me nowhere. I'm seriously done with this. I need help...
  6. Driving me nuts

    in Windows 10 Software and Apps
    Driving me nuts: I've somehow 'lost' MSVCR110.dll and MSVCP110.dll. So Cyberlink Power2Go 11 won't run. Seems that those 2 dlls are part of those Microsoft Visual C Redistributable packages that lazy companies such as Cyberlink lean on because they're too inept to develop their own C++ codes...
  7. A simple batch file...?

    in Windows 10 Network and Sharing
    A simple batch file...?: Hi, It's been a while since I delved into the depths of Windows - and long before Windows 10 - but I would like to write a batch file to copy files from a folder on my Windows 10 PC to 2 separate folders - one on an SD card and the other on an external hard drive (I have...
  8. this is driving me nuts!

    in Windows 10 BSOD Crashes and Debugging
    this is driving me nuts!: so here is the thing couple days ago i left my laptop for 1 hour with my cousin (12 year old) who had his little 4 year old brother with him,i didnt trust him with my laptop but family forced me to atleast give them a bit of fun i went outside and after an hour i cameback...
  9. all these BSODs are driving me nuts

    in Windows 10 BSOD Crashes and Debugging
    all these BSODs are driving me nuts: Hello, I'm getting very frequent BSOD's, and up to now have not been able to get to the root of the problem. The software I'm using to analyse the dumps says it's not a hardware problem. My impression is that usually the BSOD occurs on waking up from hibernation. The usual...
  10. Windows updates driving me NUTS!

    in Windows 10 Updates and Activation
    Windows updates driving me NUTS!: It seems like lately, that every time Windows does a patch/upgrade, it wipes out my Edge favorites! This has happened 3 times in the last two weeks! Also, I suddenly cannot download anything from the Windows store either. Ready to pull my hair out! How can I fix this or stop...