Why do I get "The system cannot find the path specified." ?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Haxs4Life
Posts: 13
Joined: 02 Jan 2015 23:43
Contact:

Why do I get "The system cannot find the path specified." ?

#1 Post by Haxs4Life » 26 Jan 2015 20:49

I am a noob an beginner at DOS coding so please don't complain or make fun of my bad a sloppy/messy code :/ but could anyone tell me why im getting this? My file download is below from filedropper.com. But baisicly i want the program to be looking into different folders throughout the program..but so far i've only been able to make it look within the folder its allready in, i cant get it to back up and look in different folders :/
Example code:

Code: Select all

set "Files=Files\"
set "Data=Files\Data"
set "Accounts=Files\Accounts"
set "CH=Chapters\" (This is in the Main folder with the Files folder)

:Data
cd "%Data%"
(Do some actions within this folder)

:Account Creation
cd "%Files%"
md "Accounts"


Problem: It would create the "Accounts" folder in the "Files\Data" directory path instead of the "Files" folder i want it in. Anyone know how to fix this or another way i can do this that will work how i want it to?

File Download: http://www.filedropper.com/os_3

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Why do I get "The system cannot find the path specified.

#2 Post by penpen » 27 Jan 2015 09:02

I think you are searching for:

Code: Select all

set "Files=Files\"
set "Data=Files\Data"
set "Accounts=Files\Accounts"
set "CH=Chapters\" (This is in the Main folder with the Files folder)

:Data
pushd "%Data%"
(Do some actions within this folder)
popd

:Account Creation
md "%Files%\Accounts"

penpen

Samir
Posts: 384
Joined: 16 Jul 2013 12:00
Location: HSV
Contact:

Re: Why do I get "The system cannot find the path specified.

#3 Post by Samir » 02 Feb 2015 11:09

Haxs4Life wrote:I am a noob an beginner at DOS coding so please don't complain or make fun of my bad a sloppy/messy code :/ but could anyone tell me why im getting this? My file download is below from filedropper.com. But baisicly i want the program to be looking into different folders throughout the program..but so far i've only been able to make it look within the folder its allready in, i cant get it to back up and look in different folders :/
Example code:

Code: Select all

set "Files=Files\"
set "Data=Files\Data"
set "Accounts=Files\Accounts"
set "CH=Chapters\" (This is in the Main folder with the Files folder)

:Data
cd "%Data%"
(Do some actions within this folder)

:Account Creation
cd "%Files%"
md "Accounts"


Problem: It would create the "Accounts" folder in the "Files\Data" directory path instead of the "Files" folder i want it in. Anyone know how to fix this or another way i can do this that will work how i want it to?

File Download: http://www.filedropper.com/os_3
You haven't used the set command correctly to set the variables before you can use them.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Why do I get "The system cannot find the path specified.

#4 Post by foxidrive » 02 Feb 2015 16:22

This should do what you have indicated that you need to do.

Code: Select all

set "Data=d:\Chapters\Files\Data"
set "Accounts=d:\Chapters\Files\Accounts"
md "%data%" 2>nul
md "%Accounts%" 2>nul

:Data
pushd "%Data%"
(Do some actions within this folder)
popd
:Account Creation
pushd "%Accounts%"
(Do some actions within this folder)
popd


The cd /d command is also a way to change directory.

The exact answer to a problem depends on the exact question...

Samir
Posts: 384
Joined: 16 Jul 2013 12:00
Location: HSV
Contact:

Re: Why do I get "The system cannot find the path specified.

#5 Post by Samir » 03 Feb 2015 06:13

Samir wrote:You haven't used the set command correctly to set the variables before you can use them.
I doubled-checked this and quotes are allowed like this. My mistake.

Post Reply