Monday, January 5, 2015

windows - How do you use a batch file to create another batch file that contains %username%

I have been trying to make a batch file using another batch file.
The file I want to make needs to contain %username% in order for it to be functional in other computers as well.
Whenever I try to do it it types my actual username in the file which makes it impossible to run on other computers. Can someone please help me with my problem?


Here is what I wrote in the batch file:


Echo cd c:\Users\%username%\Documents > x.bat

But when I open x.bat it says:


Echo cd c:\Users\myname\Documents

I actually know what causes this problem but I couldn't find any way to get past it.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...