> start webdev

> start webdev

The powerful PowerShell command to setup your web development directory ๐Ÿง‘๐Ÿปโ€๐Ÿ’ปโœจ

ยท

3 min read

We, developers, find it annoying or a teeny bit bothersome to set up our working directory for the same type of projects that we work on every single day or maybe even every other hour. I, as a web developer kinda found the solution to just spend a little less time in making the directory ๐Ÿ˜…. For web developers, the most common directory setup will be

  1. assets ๐Ÿ–ผ๏ธ { for dumping all pictures, icons etc }
  2. css ๐Ÿ–Œ๏ธ { where we dump all CSS files }
  3. js โš™๏ธ { folder for associated JavaScript }
  4. pages ๐Ÿ“ƒ {for additional pages to be added to the website }
  5. index.html { the main page ! }

image.png

There may be other directory setups too. I would love to know if there are any others. So once I found myself making folders manually every time I initiate projects...

for example

I used commands like mkdir or touch [filename.extension] for every directory or file I make and admit it we do hate relying on the mouse at some point or the other. I wanted to automate / semi-automate the whole process. So at first, I figured out all the exact commands I used for setting up the project directory... and they were something similar to this in the command shell / PowerShell

> mkdir assets 
> mkdir css ;cd css;touch style.scss
> mkdir js;cd js;touch app.js
> touch index.html

1. Eureka!

And I had heard of something called .bat file..which is supposed to run a bunch of windows commands when we run it and Eureka โœจ! All I had to do was figure out how to turn the above code into a .bat file ...And it turns out that I had to simply write what I want the bat file to do in the bat file in the command language. After some improvements and additions, my .bat file looked like this

mkdir css; 
mkdir js; 
mkdir assets;
mkdir pages;
echo /* css/style.css */ > css/style.css
echo // js/script.js > js/script.js  
touch index.html

2. Converting .bat file into .exe file

There were many converters online and there was this one converter that just did the thing I wanted it to do ~ .bat to .exe converter from Major Geeks and i simultaneously found a Software Walk Through guide. The first part of the guide used something called IExpress which was manually converting that batch file into a package and then to a .exe file...but the second part had a more automated approach...where you just write the batch file and it will give you the .exe file when you press convert..Fairly straightforward!

image.png

3. > start webdev

To successfully implement... start webdev... once I had the .exe file ready with the name webdev, I had to save it in C:\Windows.Why? because I had recently learned that any executable file in C:\Windows directory is directly accessible and can be opened by the command prompt or PowerShell just by writing the command start program_name, hence the path. After all these steps you are good to go ๐Ÿƒ๐Ÿปโ€โ™‚๏ธ!

Here is the final execution of the whole process ๐Ÿ˜

startwebdev.gif

You can customize the .bat file or you can create a whole new one and repeat the steps for other project setups. I invite you to create safe .bat files for other project setups too...One place would be github so I'll drop the link to the repo and feel free to contribute in anyway you can !

GitHub link for the Repo

Ps: This is my first Blog ๐Ÿคž๐Ÿป

ย