我正在尝试更改CMD中的目录,但是它不起作用它将返回当前目录,请参阅以下内容:

问题描述

C:\Users\vk Yadav>cd d:
D:\ 
C:\Users\vk Yadav>

为什么会这样?

解决方法

import numpy as np import random import copy from collections import namedtuple,deque from model import Actor,Critic import torch import torch.nn.functional as F import torch.optim as optim BUFFER_SIZE = int(1e6) # replay buffer size BATCH_SIZE = 128 # minibatch size LR_ACTOR = 1e-3 # learning rate of the actor LR_CRITIC = 1e-3 # learning rate of the critic WEIGHT_DECAY = 0 # L2 weight decay LEARN_EVERY = 1 # learning timestep interval LEARN_NUM = 5 # number of learning passes GAMMA = 0.99 # discount factor TAU = 8e-3 # for soft update of target parameters OU_SIGMA = 0.2 # Ornstein-Uhlenbeck noise parameter,volatility OU_THETA = 0.15 # Ornstein-Uhlenbeck noise parameter,speed of mean reversion EPS_START = 5.0 # initial value for epsilon in noise decay process in Agent.act() EPS_EP_END = 300 # episode to end the noise decay process EPS_FINAL = 0 # final value for epsilon after decay device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") #Critic Network (w/ Target Network)(every agent share common critic) **critic_local = Critic(24,2,0).to(device) critic_target = Critic(24,0).to(device) critic_optimizer = optim.Adam(critic_local.parameters(),lr=LR_CRITIC,weight_decay=WEIGHT_DECAY)** class Agent(): """Interacts with and learns from the environment.""" def __init__(self,state_size,action_size,num_agents,random_seed): """Initialize an Agent object. Params ====== state_size (int): dimension of each state action_size (int): dimension of each action num_agents (int): number of agents random_seed (int): random seed """ self.state_size = state_size self.action_size = action_size self.num_agents = num_agents self.seed = random.seed(random_seed) self.eps = EPS_START self.eps_decay = 1/(EPS_EP_END*LEARN_NUM) # set decay rate based on epsilon end target self.timestep = 0 # Actor Network (w/ Target Network) self.actor_local = Actor(state_size,random_seed).to(device) self.actor_target = Actor(state_size,random_seed).to(device) self.actor_optimizer = optim.Adam(self.actor_local.parameters(),lr=LR_ACTOR) # Noise process self.noise = OUNoise((num_agents,action_size),random_seed) # Replay memory self.memory = ReplayBuffer(action_size,BUFFER_SIZE,BATCH_SIZE,random_seed) 表示更改目录。您不使用它来更改驱动器。键入cd会告诉您驱动器cd D:上的当前目录是什么。

要更改驱动器,只需在D:中键入新的驱动器号,然后键入:,然后按 Enter

要了解D:的功能,请在命令提示符下键入cd

,

阅读cd /?帮助显示,将目录更改为其他驱动器时需要使用/d选项。

cd /d D:\

但使用

cd /d D:

将仅更改为具有先前路径的驱动器,类似于独立的D:命令

该命令显然适用于附加文件夹。

cd /d "D:\Some Folder\"

如果您只想更改驱动器,那么只需

D:

将更改为驱动器。但是,如果在切换到D:之前位于C:\上的特定目录中,那么运行D:将使您回到该目录中。以下内容对此进行了演示,您可以通过复制它来进行测试,在我有Some Folder的地方添加实际目录名称,然后粘贴到您的cmd窗口中。

echo off & cls
cd "%userprofile%"
cd
cd /d "D:\Some Folder\"
cd
D:
cd
C:
cd
cd /d D:
cd
cd /d C:
cd
cd /d D:\
cd
cd /d C:\
cd

在系统上运行以上命令(请注意,我使用Z:\而不是D:\enter image description here

因此,如果您打算只完全登陆驱动器或驱动器\ dir,则只需使用cd /d path

,

键入D:并按Enter。这样您就可以移至D盘