在Windows Vista上以管理员身份运行快捷方式时,如何在其他目录中启动快捷方式?

时间:2022-06-19 20:46:51

I have a shortcut on my desktop which opens a command prompt with many arguments that I need. I set the 'start in' field to d:\ and it works as expected (the prompt starts in d:). When I choose Advanced -> run as administrator and then open the shortcut, it starts in C:\Windows\System32, even though I have not changed the 'start in' field. How can I get it to start in d:\?

我的桌面上有一个快捷方式,它打开一个包含我需要的许多参数的命令提示符。我将'start in'字段设置为d:\并且它按预期工作(提示在d :)中开始。当我选择高级 - >以管理员身份运行然后打开快捷方式时,它会在C:\ Windows \ System32中启动,即使我没有更改'start in'字段。我怎样才能从d:\开始呢?

1 个解决方案

#1


10  

If you use the /k argument, you can add a single line to execute a change drive and change directory. For instance:

如果使用/ k参数,则可以添加一行来执行更改驱动器并更改目录。例如:

C:\Windows\System32\cmd.exe /k "d: & cd d:\storage"

C:\ Windows \ System32 \ cmd.exe / k“d:&cd d:\ storage”

Using & you can string together many commands on one line.

使用&你可以在一行上串起许多命令。

Edit: You can also change drive with the cd command alone "cd /d d:\storage". Thanks to Adam Mitz for the comment.

编辑:您也可以单独使用cd命令“cd / d d:\ storage”更改驱动器。感谢Adam Mitz的评论。

#1


10  

If you use the /k argument, you can add a single line to execute a change drive and change directory. For instance:

如果使用/ k参数,则可以添加一行来执行更改驱动器并更改目录。例如:

C:\Windows\System32\cmd.exe /k "d: & cd d:\storage"

C:\ Windows \ System32 \ cmd.exe / k“d:&cd d:\ storage”

Using & you can string together many commands on one line.

使用&你可以在一行上串起许多命令。

Edit: You can also change drive with the cd command alone "cd /d d:\storage". Thanks to Adam Mitz for the comment.

编辑:您也可以单独使用cd命令“cd / d d:\ storage”更改驱动器。感谢Adam Mitz的评论。