简体   繁体   中英

Problems with finding network path in Windows Batch Script Windows XP to a terminal with Embedded XP

I am almost done developing a batch file to delete files from a specific directory via remote commands. The only remaining problem to solve is getting the path name corret. The computer I am using is Windows XP, and I am logging into a machine with embedded XP.

I first use NET USE to connect to the terminal:

NET USE \\%IP% /user:UFDOMAIN\luci "city!!"

where UFDOMAIN is the Domain, luci is the user and city!! is the password (not actual domain, user, and password, but close enough).

After successfully connecting, I am temporarily trying to use the COPY command to prove I can do it before I start deleting like mad.

COPY \\%IP%\Tools\Support\filetodelete.html filetodeletecopy.html

However, when I run the code, I get an error:

The network path was not found.

I have tried multiple ways, including

\\%IP%\C:\Tools\Support\filetodelete.html
\\10.xx.x.x\Tools\Support\filetodelete.html REM - 10.xx.x.x is the actual IP
\\%IP%C:\Tools\Support\filetodelete.html

None of these work, of course (I didn't think they would, either, but it is easier to get the simple possiblities out of the way), and this code is based off of code that already works with other terminals. I thought it might be the terminal, but for all intensive purposes, this terminal is just like the others, only containing different files.

Windows creates default shares using a special syntax. Instead of using C: , you have to use C$ like this:

del \\%IP%\C$\Path\File.ext

If Windows is configured to disable the C$ type of shares, then you will have to create an explicit share to the area of the hard drive that you want to share by browsing to that folder in Windows Explorer, right clicking the folder, selecting Properties and Sharing. From there you can create a share to give access to that folder and all of its contents via the share name. For instance, I could create a share for the C: drive called CDrive , then access it this way:

del \\%IP%\CDrive\Path\File.ext

You should use caution when creating explicit shares though since by default Read access is granted to Everyone . You can adjust this, but you should be careful...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM