Computing.Net > Forums > Programming > .bat works for me but nobody else?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

.bat works for me but nobody else?

Reply to Message Icon

Name: bigb
Date: January 5, 2009 at 06:42:44 Pacific
OS: Windows XP SP2
CPU/Ram: P4
Product: Dell / ?
Subcategory: Batch
Comment:

Hi

I've got the following script that works if I run it but not if any ther user does.

It's used just to create a folder convert some files and switch to a different drive and do the same.

However if someboy else try to run this script it converts the files and creates the 1st folder but then won't copy the files as it cannot find the new folder.

ANY IDEAS???

Thanks
C

set source=T:\Adhoc\Import\Contracts

Echo Input folder Name
set /p Name=

Echo Input Month to Archive to
set/p Month=

cd /d "Old\%Month% 2009"

mkdir %Name%
pushd %source%

xcopy "*.RPT" "Old\%Month% 2009\%Name%"
xcopy "*.PDF" "Old\%Month% 2009\%Name%"
xcopy "*.PDF" "S:\Operations\Corporate Services\Distributions and HMRC\Distributions\Daily Contract Notes\"
xcopy "*.RPT" "S:\Operations\Corporate Services\Distributions and HMRC\Distributions\Daily Contract Notes\"

del *.PDF
del *.RPT


cd /d "S:\Operations\Corporate Services\Distributions and HMRC\Distributions\Daily Contract Notes\"

mkdir %Name%

xcopy "*.RPT" "%Name%"
xcopy "*.PDF" "%Name%"

cd /d "S:\Operations\Corporate Services\Distributions and HMRC\Distributions\Daily Contract Notes\"

del *.PDF
del *.RPT

for /f "skip=2 delims=" %%a in ('dir /b /a:d /o:-d 2^>NUL') do rmdir /s /q "%%a"




Sponsored Link
Ads by Google

Response Number 1
Name: scrappy1855
Date: January 5, 2009 at 09:51:56 Pacific
Reply:

Ok the thing that sticks out is your using mapped drives, I would recommend using UNC path ex:\\servername\folder just incase someone that runs the file doesn't have the same drive letter mapped to that folder. Try that and see if it helps.


0

Response Number 2
Name: reno
Date: January 5, 2009 at 10:43:48 Pacific
Reply:

cmd /e:on

maybe??


0

Response Number 3
Name: Holla
Date: January 5, 2009 at 21:43:00 Pacific
Reply:

I am not sure whether this applies to XP.
But in my Vista, bat files does not execute if there is no entry for bat in pathext env. var. Check whether there is a environment variable by the name pathext. It should have .BAT in it. May be it is missing or spoiled?

c:\holla>set pathe
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PSC1

--
Holla.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: .bat works for me but nobody else?

bat script (simple) www.computing.net/answers/programming/bat-script-simple/16034.html

Color text 2 www.computing.net/answers/programming/color-text-2/4736.html

::Excel Macro Help:: www.computing.net/answers/programming/excel-macro-help/7075.html